Gradle could not parse POM for com/rackspace/papi/commons/utilities/2.3.6/utilities-2.3.6.pom


(aullrich) #1

Builds fail with 1.10 - with 1.8 this seems to work just fine. Stacktrace fragment: Caused by: org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.UnresolvedDependencyVersionException: Unable to resolve version for dependency ‘org.springframework:spring-core:jar’

at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.GradlePomModuleDescriptorBuilder.determineVersion(GradlePomModuleDescriptorBuilder.java:318)

at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.GradlePomModuleDescriptorBuilder.addDependency(GradlePomModuleDescriptorBuilder.java:237)

at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.GradlePomModuleDescriptorParser.doParsePom(GradlePomModuleDescriptorParser.java:135)

at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.GradlePomModuleDescriptorParser.doParseDescriptor(GradlePomModuleDescriptorParser.java:61)

at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.AbstractModuleDescriptorParser.parseDescriptor(AbstractModuleDescriptorParser.java:44)

The pom is here for reference: https://gist.github.com/anonymous/8709435


(Peter Niederwieser) #2

Can you try with latest nightly?


(aullrich) #3

I surely will - thanks for the prompt response - you guys are amazing!


(aullrich) #4

Peter, the build still fails with the same error.

./gradlew --version

------------------------------------------------------------ Gradle 1.12-20140129231352+0000 ------------------------------------------------------------

Build time:

2014-01-29 23:13:52 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_11 (Oracle Corporation 23.6-b04) OS:

Mac OS X 10.9.1 x86_64


(Peter Niederwieser) #5

Raised GRADLE-3011.


(aullrich) #6

This is the pom hierarchy structure used to resolve the versions previously.

The original files are here: http://maven.research.rackspacecloud.com/content/repositories/releases/


(Peter Niederwieser) #7

Can you show the repository and dependency declaration that ultimately leads to this error?


(aullrich) #8

To isolate I created a little sample project with a class Simple.java: ‘class Simple() {}’

and this build script:

'apply plugin: ‘java’ repositories {

maven { url ‘http://maven.research.rackspacecloud.com/content/repositories/releases/’ }

mavenCentral() } dependencies {

compile ‘org.atomnuke:nuke:1.0.0’ } task wrapper(type: Wrapper) {

gradleVersion = “1.12-20140130230028+0000” }’

Hope this helps and thank you!


(aullrich) #9

There’s a bit more to it though: Even with 1.8 this wouldn’t compile. It reports:

What went wrong: Could not resolve all dependencies for configuration ‘:compile’.,

Could not find org.springframework:spring-core:working@SomeHost.

Required by:

:gIssue:unspecified > org.atomnuke:nuke:1.0.0 > com.rackspace.papi.commons:utilities:2.3.5

Could not find org.springframework:spring-beans:working@SomeHost.

Required by:

:gIssue:unspecified > org.atomnuke:nuke:1.0.0 > com.rackspace.papi.commons:utilities:2.3.5

Could not find org.springframework:spring-context:working@SomeHost.

Required by

:gIssue:unspecified > org.atomnuke:nuke:1.0.0 > com.rackspace.papi.commons:utilities:2.3.5

Could not find org.springframework:spring-web:working@SomeHost.

Required by:

:gIssue:unspecified > org.atomnuke:nuke:1.0.0 > com.rackspace.papi.commons:utilities:2.3.5

Could not find com.sun.jersey:jersey-client:working@SomeHost.

Required by:

:gIssue:unspecified > org.atomnuke:nuke:1.0.0 > com.rackspace.papi.commons:utilities:2.3.5

Changing the build script to:

apply plugin: 'java'
repositories {
    maven { url 'http://maven.research.rackspacecloud.com/content/repositories/releases/' }
    mavenCentral()
}
  configurations.compile.resolutionStrategy {
    eachDependency { DependencyResolveDetails details ->
        //specifying a fixed version for all libraries with 'org.springframework' group
        if (details.requested.group == 'org.springframework') {
            details.useVersion '3.2.3.RELEASE'
        }
    }
    force 'com.sun.jersey:jersey-client:1.13'
}
  dependencies {
    compile 'org.atomnuke:nuke:1.0.0'
}
task wrapper(type: Wrapper) {
  gradleVersion = "1.12-20140130230028+0000"
  //gradleVersion = '1.8'
}

works with 1.8, but not with the latest gradle build.


(Benjamin Muschko) #10

The dependencies are defined in the profile of one of the parent POMs. Maven profiles are not supported in Gradle. Maven also highly discourages the use of the profiles for providing dependency versions in published POMs.


(aullrich) #11

Understood, Benjamin.

With 1.8 we were able to overcome this ‘shortcoming’ in the published third party pom by specifying the version in gradle, nicely leveraging the flexibility and power gradle provides.

No need to fiddle around and trying to fix third party poms and rather staying cleanly in gradle land with the solution.

With 1.10+ this option seems no longer available to us?

Thanks!


(Benjamin Muschko) #12

With 1.10 the POM parser code has become more strict. You might want to track GRADLE-2982. That issue will address excluding dependencies before the exception is thrown.


(aullrich) #13

Yup, similar case - exclude there and forcing here. Both might be ok strategies to support for pom files that don’t provide version specification directly, but that’s for you guys to decide. Thanks - enough said from my part - I’ll be tracking the outcome.


(Carlo Luib-Finetti) #14

I also had this error “Gradle could not parse POM” when moving file dependencies to our company’s Artifactory. When Artifactory does upload a jar, it looks into the jar and it will find a maven pom. In my case I found that these maven poms had references to a parent pom - which did not exist in Artifactory. (And also, the pom.xml had the build section which is not needed and might cause problems). After creating and uploading parent poms and cleaning the jars poms Gradle was able to resolve the dependencies.


(Benjamin Muschko) #15

As of Gradle 1.12 this should work fine. I tried your example with 1.12 as well as 2.0.