Unable to resolve version for dependency

I’m trying to set-up Pax-Exam in gradle: - GitHub - lburgazzoli/lb-axon - https://github.com/lburgazzoli/lb-axon/blob/master/axon-osgi/build.gradle

But the test step fails to start because of the following error:

  • What went wrong: Could not resolve all dependencies for configuration ‘:axon-osgi:testCompile’. > Could not resolve org.ops4j.pax.exam:pax-exam-spi:3.4.0.

Required by:

com.github.lburgazzoli:axon-osgi:1.0.0.SNAPSHOT > org.ops4j.pax.exam:pax-exam-container-native:3.4.0

com.github.lburgazzoli:axon-osgi:1.0.0.SNAPSHOT > org.ops4j.pax.exam:pax-exam-junit4:3.4.0

Could not parse POM http://repo1.maven.org/maven2/org/ops4j/pax/exam/pax-exam-spi/3.4.0/pax-exam-spi-3.4.0.pom

Unable to resolve version for dependency ‘com.google.guava:guava:jar’

Looking at pax-exam-spi-3.4.0.pom, the version tag is effectively not provided but a very similar project builds without problem with Maven: any hint?

First step is to figure out how the version is provided. If it builds in Maven, the version has to be provided somehow. Also make sure to try with the latest Gradle version (and perhaps even with latest nightly), because I think there have been some related improvements lately.

I’ve tested with gradle 1.10 and with nightly build 1.12-20140124230013 but they still fail in dependency resolution.

Here the Maven dependecy:tree ‘’’ [INFO] ± org.ops4j.pax.exam:pax-exam-container-native:jar:3.4.0:test [INFO] | ± org.ops4j.pax.exam:pax-exam:jar:3.4.0:test [INFO] | | - org.ops4j.base:ops4j-base-store:jar:1.4.0:test [INFO] | |

- org.ops4j.base:ops4j-base-io:jar:1.4.0:test [INFO] | ± org.ops4j.pax.exam:pax-exam-spi:jar:3.4.0:test [INFO] | | ± org.ops4j.base:ops4j-base-spi:jar:1.4.0:test [INFO] | | ± com.google.guava:guava:jar:12.0:test [INFO] | | | - com.google.code.findbugs:jsr305:jar:1.3.9:test [INFO] | | - org.ops4j.pax.tinybundles:tinybundles:jar:2.0.0:test [INFO] | |

- biz.aQute.bnd:bndlib:jar:2.1.0:test [INFO] | ± org.ops4j.pax.swissbox:pax-swissbox-core:jar:1.7.0:test [INFO] | | - org.ops4j.pax.swissbox:pax-swissbox-lifecycle:jar:1.7.0:test [INFO] | ± org.ops4j.pax.swissbox:pax-swissbox-tracker:jar:1.7.0:test [INFO] | ± org.ops4j.base:ops4j-base-lang:jar:1.4.0:test [INFO] | ± org.ops4j.base:ops4j-base-net:jar:1.4.0:test [INFO] | | - org.ops4j.base:ops4j-base-monitors:jar:1.4.0:test [INFO] | ± org.ops4j.pax.url:pax-url-link:jar:1.6.0:test [INFO] | - org.ops4j.pax.url:pax-url-classpath:jar:1.6.0:test ‘’’

And here the gradle one: ‘’’ ±-- org.ops4j.pax.exam:pax-exam-container-native:3.4.0 |

±-- org.ops4j.pax.exam:pax-exam:3.4.0 |

|

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

|

±-- org.ops4j.base:ops4j-base-store:1.4.0 |

|

|

±-- org.slf4j:slf4j-api:1.5.11 -> 1.7.5 |

|

|

— org.ops4j.base:ops4j-base-io:1.4.0 |

|

|

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

|

|

— org.ops4j.base:ops4j-base-monitors:1.4.0 |

|

— org.ops4j.base:ops4j-base-util-property:1.4.0 |

±-- org.ops4j.pax.exam:pax-exam-spi:3.4.0 FAILED |

±-- org.ops4j.pax.swissbox:pax-swissbox-core:1.7.0 |

|

±-- org.ops4j.pax.swissbox:pax-swissbox-lifecycle:1.7.0 |

|

— org.ops4j.base:ops4j-base-lang:1.4.0 |

±-- org.ops4j.pax.swissbox:pax-swissbox-tracker:1.7.0 |

|

±-- org.ops4j.pax.swissbox:pax-swissbox-lifecycle:1.7.0 |

|

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

|

— org.slf4j:slf4j-api:1.5.11 -> 1.7.5 |

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

±-- org.ops4j.base:ops4j-base-net:1.4.0 |

|

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

|

— org.ops4j.base:ops4j-base-monitors:1.4.0 |

±-- org.ops4j.pax.url:pax-url-link:1.6.0 |

|

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

|

±-- org.ops4j.base:ops4j-base-util-property:1.4.0 |

|

— org.ops4j.pax.url:pax-url-commons:1.6.0 |

|

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

|

±-- org.ops4j.pax.swissbox:pax-swissbox-property:1.7.0 |

|

|

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

|

|

— org.ops4j.base:ops4j-base-util-property:1.4.0 |

|

— org.slf4j:slf4j-api:1.5.11 -> 1.7.5 |

— org.ops4j.pax.url:pax-url-classpath:1.6.0 |

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

±-- org.ops4j.base:ops4j-base-util-property:1.4.0 |

±-- org.ops4j.pax.swissbox:pax-swissbox-optional-jcl:1.7.0 |

— org.ops4j.pax.url:pax-url-commons:1.6.0 (*) ‘’’

it works with gradle 1.9

‘’’ ±-- org.ops4j.pax.exam:pax-exam-container-native:3.4.0 |

±-- org.ops4j.pax.exam:pax-exam:3.4.0 (*) |

±-- org.ops4j.pax.exam:pax-exam-spi:3.4.0 (*) |

±-- org.ops4j.pax.swissbox:pax-swissbox-core:1.7.0 |

|

±-- org.ops4j.pax.swissbox:pax-swissbox-lifecycle:1.7.0 |

|

— org.ops4j.base:ops4j-base-lang:1.4.0 |

±-- org.ops4j.pax.swissbox:pax-swissbox-tracker:1.7.0 |

|

±-- org.ops4j.pax.swissbox:pax-swissbox-lifecycle:1.7.0 |

|

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

|

— org.slf4j:slf4j-api:1.5.11 -> 1.7.5 |

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

±-- org.ops4j.base:ops4j-base-net:1.4.0 |

|

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

|

— org.ops4j.base:ops4j-base-monitors:1.4.0 |

±-- org.ops4j.pax.url:pax-url-link:1.6.0 |

|

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

|

±-- org.ops4j.base:ops4j-base-util-property:1.4.0 |

|

— org.ops4j.pax.url:pax-url-commons:1.6.0 |

|

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

|

±-- org.ops4j.pax.swissbox:pax-swissbox-property:1.7.0 |

|

|

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

|

|

— org.ops4j.base:ops4j-base-util-property:1.4.0 |

|

— org.slf4j:slf4j-api:1.5.11 -> 1.7.5 |

— org.ops4j.pax.url:pax-url-classpath:1.6.0 |

±-- org.ops4j.base:ops4j-base-lang:1.4.0 |

±-- org.ops4j.base:ops4j-base-util-property:1.4.0 |

±-- org.ops4j.pax.swissbox:pax-swissbox-optional-jcl:1.7.0 |

— org.ops4j.pax.url:pax-url-commons:1.6.0 (*) ‘’’

Same problem on gradle 1.11-rc1, any hint?

Same result with gradle-1.11:

‘’’ luca@juniper lb-axon]# gradle -version

------------------------------------------------------------ Gradle 1.11 ------------------------------------------------------------

Build time:

2014-02-11 11:34:39 UTC Build number: none Revision:

a831fa866d46cbee94e61a09af15f9dd95987421

Groovy:

1.8.6 Ant:

Apache Ant™ version 1.9.2 compiled on July 8 2013 Ivy:

2.2.0 JVM:

1.7.0_51 (Oracle Corporation 24.51-b03) OS:

Mac OS X 10.9.1 x86_64

[luca@juniper lb-axon]# gradle :axon-osgi:test

  • What went wrong: Could not resolve all dependencies for configuration ‘:axon-osgi:testCompile’. > Could not resolve org.ops4j.pax.exam:pax-exam-spi:3.4.0.

Required by:

com.github.lburgazzoli:axon-osgi:1.0.0.SNAPSHOT > org.ops4j.pax.exam:pax-exam-junit4:3.4.0

Could not parse POM http://repo1.maven.org/maven2/org/ops4j/pax/exam/pax-exam-spi/3.4.0/pax-exam-spi-3.4.0.pom

Unable to resolve version for dependency ‘com.google.guava:guava:jar’

Could not parse POM /Users/luca/.m2/repository/org/ops4j/pax/exam/pax-exam-spi/3.4.0/pax-exam-spi-3.4.0.pom

Unable to resolve version for dependency ‘com.google.guava:guava:jar’

‘’’

Same problem with 1.12 nightly :

‘’’ ------------------------------------------------------------ Gradle 1.12-20140307230018+0000 ------------------------------------------------------------

Build time:

2014-03-07 23:00:18 UTC Build number: none Revision:

a831fa866d46cbee94e61a09af15f9dd95987421

Groovy:

1.8.6 Ant:

Apache Ant™ version 1.9.3 compiled on December 23 2013 Ivy:

2.2.0 JVM:

1.7.0_51 (Oracle Corporation 24.51-b03) OS:

Mac OS X 10.9.2 x86_64

  • What went wrong: Could not resolve all dependencies for configuration ‘:axon-osgi:testCompile’. > Could not resolve org.ops4j.pax.exam:pax-exam-spi:3.4.0.

Required by:

com.github.lburgazzoli:axon-osgi:1.0.0.SNAPSHOT > org.ops4j.pax.exam:pax-exam-junit4:3.4.0

Could not parse POM http://repo1.maven.org/maven2/org/ops4j/pax/exam/pax-exam-spi/3.4.0/pax-exam-spi-3.4.0.pom

Unable to resolve version for dependency ‘com.google.guava:guava:jar’

java.lang.NullPointerException (no error message)

‘’’

Is there anyone looking at this issue? It was working on 1.9 so it looks like a gradle bug.

The problem is with guava version. It is specified in dependencyManagement of the parent pom under a profile. In Gradle 1.7 it used to fail guava resolution which I could easily fix by excluding guava from pax-exam-junit4 dependency and adding my own. In 1.10+ it fails to resolve pax-exam-spi. Exclusion of guava and even setting transitive to false does not work any more. As an experiment, I’ve added guava to pax-exam pom in my local Gradle cache. Works like a charm. Is there a better workaround except of deploying modified pax-exam in a local repo?

Thanks for investigating. This may be a consequence of the stricter POM parsing in Gradle 1.10+. I’m not aware of a workaround other than editing the POM. Raised GRADLE-3045.

Found it.

In my project created directory pax-exam/org/ops4j/pax/exam/3.4.0/.

Copied exam-3.4.0.pom to the directory. Added guava to the pom dependencyManagement

<dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${dependency.guava.version}</version>
            </dependency>

Set up repositories in build.gradle:

repositories {
   maven { url file('pax-exam').toURL() }
    mavenCentral()
}