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 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.
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?
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.
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.
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.