Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolution for snapshot artifacts is broken when defining multiple repositories with the same hostname #1883

Closed
denisrosca opened this issue Jul 26, 2023 · 0 comments · Fixed by #1884

Comments

@denisrosca
Copy link
Contributor

denisrosca commented Jul 26, 2023

Snapshot dependency resolution is broken if multiple repositories with the same hostname are defined in smithy-build.json.

The underlying aether resolution relies on the repository definition to have a discriminator id for de-duplicating repositories.
The current smithy build definition doesn't have that, thus resolution fails.

Steps to reproduce

Consider the following smithy definition:

{
    "version": "1.0",
    "maven": {
        "repositories": [
            {
                "url": "http://localhost:1234/artifactory-1"
            },
            {
                "url": "http://localhost:1234/artifactory-2"
            }
        ],
        "dependencies": [
            // Normally, this could refer to SMITHY_VERSION, but that doesn't work for pre-release builds.
            "com.example:artifact:1.0.0-SNAPSHOT"
        ]
    }
}

and the following pom file definition for com.example:artifact:1.0.0-SNAPSHOT:

<?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://maven.apache.org/POM/4.0.0\">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>artifact</artifactId>
    <packaging>jar</packaging>
    <description>artifact</description>
    <version>1.0.0-SNAPSHOT</version>
    <name>artifact</name>
    <organization>
        <name>com.example</name>
    </organization>
    <properties>
        <info.versionScheme>early-semver</info.versionScheme>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.example</groupId>
            <artifactId>dependency</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
</project>

After configuring

  • http://localhost:1234/artifactory-1 to host the release version of com.example:dependency:1.0.0
  • http://localhost:1234/artifactory-2 to host the snapshot version of com.example:artifact:1.0.0-SNAPSHOT

We would expect the dependency resolution to succeed, but instead it fails.

Fixed by #1884 and 6e68005 adds a test to exemplify the behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant