Property in pom's version field results to wrong dependency resolution #647

Closed
galderz opened this Issue Jan 18, 2013 · 11 comments

Comments

Projects
None yet
4 participants
@galderz

galderz commented Jan 18, 2013

(I'm going to edit this report so it's easier to review it @eed3si9n)

steps

Create the following directory structure:

+- sbtpomtest/
    +- fakebase/
    +- fakeivy/
    +- sample/
        +- project/
            +- build.properties
        +- build.sbt
        +- sbt-launcher-script.sh

Here's build.properties:

sbt.version=0.13.0

Here's build.sbt:

name := "sbtpomtest"

organization := "com.example"

version := "0.1-SNAPSHOT"

libraryDependencies ++= Seq(
   "org.jboss.shrinkwrap" % "shrinkwrap-api" % "1.0.1",
   "org.jboss.shrinkwrap" % "shrinkwrap-impl-base" % "1.0.1",
   "io.escalante" % "escalante-dist" % "0.2.0" artifacts(Artifact("escalante-dist", "zip", "zip")),
   "org.jboss.as" % "jboss-as-arquillian-container-embedded" % "7.x.incremental.546",
   "org.jboss.arquillian.core" % "arquillian-core-api" % "1.0.3.Final",
   "org.jboss.arquillian.core" % "arquillian-core-spi" % "1.0.3.Final",
   "org.jboss.arquillian.core" % "arquillian-core-impl-base" % "1.0.3.Final",
   "org.jboss.arquillian.container" % "arquillian-container-spi" % "1.0.3.Final",
   "org.jboss.arquillian.container" % "arquillian-container-impl-base" % "1.0.3.Final",
   "org.jboss.arquillian.test" % "arquillian-test-impl-base" % "1.0.3.Final",
   "org.yaml" % "snakeyaml" % "1.8"
)

resolvers ++= Seq(
  "JBoss repository" at "http://repository.jboss.org/nexus/content/groups/public/",
  "Project Odd repository" at "http://repository-projectodd.forge.cloudbees.com/upstream/"
)

and here's sbt-launcher-script.sh:

#!/bin/sh
SBT_OPTS='-Dsbt.global.base=/Users/foo/sbtpomtest/fakebase -Dsbt.ivy.home=/Users/foo/sbtpomtest/fakeivy '$SBT_OPTS
exec java -Xmx512M ${SBT_OPTS} -XX:MaxPermSize=512M -jar ~/Applications/sbt/sbt-launch-0.13.0.jar "$@"

(The script needs to be changed depending on where your jar, fakebase/, and fakeivy/ are)

chmod +x and run the script:

[sbtpomtest]$ cd sample
[sample]$ chmod +x ./sbt-launcher-script.sh 
[sample]$ ./sbt-launcher-script.sh

Next, run compile from the sbt shell.

> compile
[info] Updating {file:/Users/foo/sbtpomtest/sample/}sample...

result (as of 12/2/2013 using sbt 0.13)

[info] downloading http://repo1.maven.org/maven2/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api/1.0.0-beta-5/shrinkwrap-resolver-api-1.0.0-beta-5.jar ...
[info]  [SUCCESSFUL ] org.jboss.shrinkwrap.resolver#shrinkwrap-resolver-api;1.0.0-beta-5!shrinkwrap-resolver-api.jar (217ms)
[info] downloading http://repo1.maven.org/maven2/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api-maven/1.0.0-beta-5/shrinkwrap-resolver-api-maven-1.0.0-beta-5.jar ...
[info]  [SUCCESSFUL ] org.jboss.shrinkwrap.resolver#shrinkwrap-resolver-api-maven;1.0.0-beta-5!shrinkwrap-resolver-api-maven.jar (209ms)
[info] downloading http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon-file/1.0-beta-7/wagon-file-1.0-beta-7.jar ...
[info]  [SUCCESSFUL ] org.apache.maven.wagon#wagon-file;1.0-beta-7!wagon-file.jar (219ms)
[info] downloading http://repo1.maven.org/maven2/org/jboss/arquillian/test/arquillian-test-spi/1.0.3.Final/arquillian-test-spi-1.0.3.Final.jar ...
[info]  [SUCCESSFUL ] org.jboss.arquillian.test#arquillian-test-spi;1.0.3.Final!arquillian-test-spi.jar (221ms)
[info] Done updating.
[success] Total time: 475 s, completed Dec 2, 2013 10:40:13 PM
> 

original bug report (was "Wrong dependency version resolution leading to build halt")

Hi, as a result #646 I've nuked my ~/.ivy2/local and ~/.ivy2/cache folders and when I try to update my SBT plugin I get:

[warn]  :: org.jboss.shrinkwrap.descriptors#shrinkwrap-descriptors-api-base;1.0.3.Final: not found
[warn]  :: org.jboss.shrinkwrap.descriptors#shrinkwrap-descriptors-spi;1.0.3.Final: not found

I think this is a problem where the dependency version to use for this dependency is not correctly calculated (not my lucky day today...). Let me explain:

Looking at the debug log I see: https://gist.github.com/4564402

That Shrinkwrap dependency comes from org.jboss.arquillian.config#arquillian-config-impl-base;1.0.3.Final dependency. The pom for this dependency is:

https://repository.jboss.org/nexus/content/groups/public/org/jboss/arquillian/config/arquillian-config-impl-base/1.0.3.Final/arquillian-config-impl-base-1.0.3.Final.pom

which states:

<dependency>
    <groupId>org.jboss.shrinkwrap.descriptors</groupId>
    <artifactId>shrinkwrap-descriptors-spi</artifactId>
    <scope>compile</scope>
</dependency>

This dependency's version should be resolved checking the parent, which is:
https://repository.jboss.org/nexus/content/groups/public/org/jboss/arquillian/arquillian-build/1.0.3.Final/arquillian-build-1.0.3.Final.pom

This build parent defines:

<dependency>
    <groupId>org.jboss.shrinkwrap.descriptors</groupId>
    <artifactId>shrinkwrap-descriptors-bom</artifactId>
    <version>${version.shrinkwrap_descriptors}</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

${version.shrinkwrap_descriptors} is defined in this last pom's parent:
https://repository.jboss.org/nexus/content/groups/public/org/jboss/arquillian/arquillian-parent/1.0.3.Final/arquillian-parent-1.0.3.Final.pom

which defines:

<version.shrinkwrap_descriptors>2.0.0-alpha-3</version.shrinkwrap_descriptors>

And that references:

https://repository.jboss.org/nexus/content/groups/public/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-bom/2.0.0-alpha-3/shrinkwrap-descriptors-bom-2.0.0-alpha-3.pom

Which defines:

<dependency>
    <groupId>org.jboss.shrinkwrap.descriptors</groupId>
    <artifactId>shrinkwrap-descriptors-spi</artifactId>
    <version>${project.version}</version>
</dependency>

Where project.version=2.0.0-alpha-3, so that should resolve in:

https://repository.jboss.org/nexus/content/groups/public/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-spi/2.0.0-alpha-3/shrinkwrap-descriptors-spi-2.0.0-alpha-3.jar

What is going on here? Is this an SBT or ivy issue?

@galderz

This comment has been minimized.

Show comment
Hide comment
@galderz

galderz Jan 18, 2013

Btw, my dependencies are:

libraryDependencies ++= Seq(
   "org.jboss.shrinkwrap" % "shrinkwrap-api" % "1.0.1",
   "org.jboss.shrinkwrap" % "shrinkwrap-impl-base" % "1.0.1",
   "io.escalante" % "escalante-dist" % "0.2.0-SNAPSHOT" artifacts(Artifact("escalante-dist", "zip", "zip")),
   "org.jboss.as" % "jboss-as-arquillian-container-embedded" % "7.x.incremental.546",
   "org.jboss.arquillian.core" % "arquillian-core-api" % "1.0.0.Final",
   "org.jboss.arquillian.core" % "arquillian-core-spi" % "1.0.0.Final",
   "org.jboss.arquillian.core" % "arquillian-core-impl-base" % "1.0.0.Final",
   "org.jboss.arquillian.container" % "arquillian-container-spi" % "1.0.0.Final",
   "org.jboss.arquillian.container" % "arquillian-container-impl-base" % "1.0.0.Final",
   "org.jboss.arquillian.test" % "arquillian-test-impl-base" % "1.0.0.Final",
   "org.yaml" % "snakeyaml" % "1.8"
)

galderz commented Jan 18, 2013

Btw, my dependencies are:

libraryDependencies ++= Seq(
   "org.jboss.shrinkwrap" % "shrinkwrap-api" % "1.0.1",
   "org.jboss.shrinkwrap" % "shrinkwrap-impl-base" % "1.0.1",
   "io.escalante" % "escalante-dist" % "0.2.0-SNAPSHOT" artifacts(Artifact("escalante-dist", "zip", "zip")),
   "org.jboss.as" % "jboss-as-arquillian-container-embedded" % "7.x.incremental.546",
   "org.jboss.arquillian.core" % "arquillian-core-api" % "1.0.0.Final",
   "org.jboss.arquillian.core" % "arquillian-core-spi" % "1.0.0.Final",
   "org.jboss.arquillian.core" % "arquillian-core-impl-base" % "1.0.0.Final",
   "org.jboss.arquillian.container" % "arquillian-container-spi" % "1.0.0.Final",
   "org.jboss.arquillian.container" % "arquillian-container-impl-base" % "1.0.0.Final",
   "org.jboss.arquillian.test" % "arquillian-test-impl-base" % "1.0.0.Final",
   "org.yaml" % "snakeyaml" % "1.8"
)
@galderz

This comment has been minimized.

Show comment
Hide comment
@galderz

galderz Jan 18, 2013

Actually, this was happening after clearing the cache and trying to build a project that used the plugin. I tried building the plugin, which has those dependencies I mentioned, first and it worked fine (it resolved the right dependency). I then built with the project again and it worked fine. Very odd.

galderz commented Jan 18, 2013

Actually, this was happening after clearing the cache and trying to build a project that used the plugin. I tried building the plugin, which has those dependencies I mentioned, first and it worked fine (it resolved the right dependency). I then built with the project again and it worked fine. Very odd.

@galderz

This comment has been minimized.

Show comment
Hide comment
@galderz

galderz Jan 25, 2013

This has appeared again: https://groups.google.com/forum/?fromgroups=#!topic/liftweb/H-WR48BojSc

A way to recreate this issue is the following:

  1. Clear Ivy cache.
  2. Try building one of the Escalante Quickstarts with SBT, i.e. https://github.com/escalante/escalante-quickstart/tree/master/helloworld-lift

^ That should fail with a dependency resolution bug.

In my response to the liftweb topic, I explained a workaround I used to solve the issue which literally involves building the Escalante SBT plugin from scratch, which resolves the dependency correctly, then build one of the Escalante Quickstarts.

galderz commented Jan 25, 2013

This has appeared again: https://groups.google.com/forum/?fromgroups=#!topic/liftweb/H-WR48BojSc

A way to recreate this issue is the following:

  1. Clear Ivy cache.
  2. Try building one of the Escalante Quickstarts with SBT, i.e. https://github.com/escalante/escalante-quickstart/tree/master/helloworld-lift

^ That should fail with a dependency resolution bug.

In my response to the liftweb topic, I explained a workaround I used to solve the issue which literally involves building the Escalante SBT plugin from scratch, which resolves the dependency correctly, then build one of the Escalante Quickstarts.

galderz added a commit to escalante/sbt-escalante that referenced this issue Jan 29, 2013

Update Escalante to 0.2.0. Workaround sbt/sbt#647 by explicitly depen…
…ding on correct shrinkwrap-descriptors-spi library version.
@galderz

This comment has been minimized.

Show comment
Hide comment

galderz commented Mar 12, 2013

Even with the workaround, the issue still appears under certain circumstances, see http://stackoverflow.com/questions/15351171/escalante-sbt-plugin-does-not-find-org-jboss-shrinkwrap-descriptorsshrinkwrap-d :((

@galderz

This comment has been minimized.

Show comment
Hide comment
@galderz

galderz Mar 20, 2013

Can someone with a bit of Ivy experience give us a hand here? The stackoverflow post has a simple SBT configuration that can be used to replicate the issue. We might have found another workaround ... but requires an alternative way of plugin the SBT plugin.

galderz commented Mar 20, 2013

Can someone with a bit of Ivy experience give us a hand here? The stackoverflow post has a simple SBT configuration that can be used to replicate the issue. We might have found another workaround ... but requires an alternative way of plugin the SBT plugin.

arashi01 added a commit to arashi01/escalante-quickstart that referenced this issue Mar 30, 2013

galderz added a commit to galderz/escalante-quickstart that referenced this issue Apr 4, 2013

galderz added a commit to escalante/escalante-quickstart that referenced this issue Apr 4, 2013

@galderz galderz referenced this issue in escalante/escalante-quickstart Aug 6, 2013

Open

Can't build quikstart helloworld-play #13

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Dec 3, 2013

Member

@galderz I was curious about this case, so I tried to create a reliable reproduction steps (see the updated description), but was not able to reproduce the issue using sbt 0.13.0. Could you confirm the problem still exists please?

Member

eed3si9n commented Dec 3, 2013

@galderz I was curious about this case, so I tried to create a reliable reproduction steps (see the updated description), but was not able to reproduce the issue using sbt 0.13.0. Could you confirm the problem still exists please?

@eed3si9n eed3si9n added the Invalid label Apr 1, 2014

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Apr 1, 2014

Member

Apparently my old self had tried to repro it and couldn't so I'll close this for now.

Member

eed3si9n commented Apr 1, 2014

Apparently my old self had tried to repro it and couldn't so I'll close this for now.

@eed3si9n eed3si9n closed this Apr 1, 2014

@jsuereth

This comment has been minimized.

Show comment
Hide comment
@jsuereth

jsuereth Apr 1, 2014

Member

Actually, this is still a problem, but with wierd maven-parent-project setups.... I'll see if I can get you a legitimate reproducible case.

Member

jsuereth commented Apr 1, 2014

Actually, this is still a problem, but with wierd maven-parent-project setups.... I'll see if I can get you a legitimate reproducible case.

arashi01 added a commit to arashi01/sbt-issue-647-reproduction that referenced this issue Apr 14, 2014

@arashi01

This comment has been minimized.

Show comment
Hide comment
@arashi01

arashi01 Apr 14, 2014

@eed3si9n @jsuereth

Please find reproduced case at https://github.com/arashi01/sbt-issue-647-reproduction. The workaround branch also demonstrates functioning workaround.

Tested with sbt 0.13.5-M2

@eed3si9n @jsuereth

Please find reproduced case at https://github.com/arashi01/sbt-issue-647-reproduction. The workaround branch also demonstrates functioning workaround.

Tested with sbt 0.13.5-M2

@jsuereth

This comment has been minimized.

Show comment
Hide comment
@jsuereth

jsuereth Apr 14, 2014

Member

@arashi01 Thanks for the reproducible test case.

Member

jsuereth commented Apr 14, 2014

@arashi01 Thanks for the reproducible test case.

@jsuereth jsuereth reopened this Apr 14, 2014

@jsuereth jsuereth added Bug and removed Invalid labels Apr 14, 2014

@jsuereth jsuereth added this to the 1.0 milestone Apr 14, 2014

@jsuereth jsuereth modified the milestones: 0.13.8, 1.0 Dec 16, 2014

@jsuereth jsuereth self-assigned this Dec 16, 2014

@jsuereth

This comment has been minimized.

Show comment
Hide comment
@jsuereth

jsuereth Dec 16, 2014

Member

Related #1755

Member

jsuereth commented Dec 16, 2014

Related #1755

@jsuereth jsuereth added the in progress label Jan 7, 2015

jsuereth added a commit that referenced this issue Jan 8, 2015

Create a new Ivy DependencyResolver which uses Aether.
* Here we wire Aether into the Ivy dependency chain
* Add hooks into Aether to use Ivy's http library (so credentials are configured the same)
* Create the actual Resolver which extracts metadata information from Aether
* Deprecate old Ivy-Maven integrations
* Create hooks in existing Resolver facilities to expose a flag to enable the new behavior.
* Create notes documenting the feature.
* Create a new resolver type `MavenCache` which denotes how to read/write local maven cache metadata
  correctly.  We use this type for publishM2 and mavenLocal.
* Update failing -SNAPSHOT related tests to use new Aether resolver
* Create specification for expected behavior from the new resolvers.

Known to fix #1322, #321, #647, #1616

@eed3si9n eed3si9n closed this in #1793 Jan 14, 2015

@eed3si9n eed3si9n removed the in progress label Jan 14, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment