sam / doubleshot

Build and Dependency Management for mixed Java/Ruby projects.
MIT License
19 stars 22 forks source link

mvn dependency:list does not resolve the same list as Aether #47

Closed sam closed 12 years ago

sam commented 12 years ago

mvn dependency:list will return a dependency for org.sonatype.sisu:sisu-guice:jar:no_aop:3.0.3 while Aether will resolve it to org.sonatype.sisu:sisu-guice:jar:3.0.3.

This causes a second full test run after bootstrapping to fail.

Not sure of the solution right now. I guess either figure out why we're getting different dependencies through Aether, and correct that, or play with bootstrapping to ensure that Doubleshot#setup! is always short-circuited to bootstrap for Doubleshot itself.

ckrailo commented 12 years ago

In Aether.java:

public List<String> getResolvedCoordinates() {
    List<String> result = new ArrayList<String>();

    PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
    node.accept( nlg );

    for ( DependencyNode node: nlg.getNodes() )
    {
        if ( node.getDependency() != null )
        {
            Artifact artifact = node.getDependency().getArtifact();
            if ( artifact.getFile() != null)
            {
                StringBuilder coord = new StringBuilder(artifact.getGroupId()).append(":").append(artifact.getArtifactId())
                        .append(":").append(artifact.getExtension()).append(":").append(artifact.getVersion());
                result.add(coord.toString());
            }
        }
    }

    return result;
}

Makes me think that Aether doesn't support 5-part coordinate strings. I'm investigating why this is this case now.

ckrailo commented 12 years ago

[Sonatype supports all 5 parts of coordinates.](http://sonatype.github.com/sonatype-aether/apidocs/org/sonatype/aether/util/artifact/DefaultArtifact.html#DefaultArtifact(java.lang.String%29)

Fairly sure all we need to do is update Aether.getResolvedCoordinates() to return the 5-part coordinate. Will test along those lines.

ckrailo commented 12 years ago

Okay, changing Aether.getResolvedCoordinates() did nothing. It seems sonatype's Aether stuff just ignores no_aop or does stuff differently.

What did work was adding the exclusion for guice in our POM:

    <dependency>
      <groupId>org.sonatype.aether</groupId>
      <artifactId>aether-connector-wagon</artifactId>
      <version>1.13.1</version>
      <type>jar</type>
      <exclusions>
        <exclusion>
          <groupId>org.sonatype.sisu</groupId>
          <artifactId>sisu-guice</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

Only problem is, an auto-generated POM won't have that, so unless you object, I'm going to add an exclude method to JarDependency that we can chain, which would make the relevant line in our Doubleshot file be:

config.jar("org.sonatype.aether:aether-connector-wagon:jar:1.13.1").exclude("org.sonatype.sisu:sisu-guice")

Then our POM writer can handle exporting out those exclusions.

Adding the exclusion and adding the following to our dependencies eliminated the errors:

    <dependency>
      <groupId>org.sonatype.sisu</groupId>
      <artifactId>sisu-guice</artifactId>
      <classifier></classifier>
      <version>3.0.3</version>
      <type>jar</type>
    </dependency>
sam commented 12 years ago

Sounds ace to me.

-Sam

On Oct 30, 2012, at 9:26 PM, Christopher Krailo notifications@github.com wrote:

Okay, changing Aether.getResolvedCoordinates() did nothing. It seems sonatype's Aether stuff just ignores no_aop or does stuff differently.

What did work was adding the exclusion for guice in our POM:

<dependency>
  <groupId>org.sonatype.aether</groupId>
  <artifactId>aether-connector-wagon</artifactId>
  <version>1.13.1</version>
  <type>jar</type>
  <exclusions>
    <exclusion>
      <groupId>org.sonatype.sisu</groupId>
      <artifactId>sisu-guice</artifactId>
    </exclusion>
  </exclusions>
</dependency>

Only problem is, an auto-generated POM won't have that, so unless you object, I'm going to add an exclude method to JarDependency that we can chain, which would make the relevant line in our Doubleshot file be:

config.jar("org.sonatype.aether:aether-connector-wagon:jar:1.13.1").exclude("org.sonatype.sisu:sisu-guice") Then our POM writer can handle exporting out those exclusions.

Adding the exclusion and adding the following to our dependencies eliminated the errors:

<dependency>
  <groupId>org.sonatype.sisu</groupId>
  <artifactId>sisu-guice</artifactId>
  <classifier></classifier>
  <version>3.0.3</version>
  <type>jar</type>
</dependency

— Reply to this email directly or view it on GitHub.