[1.4-rc-1] Cannot parse dependency's parent pom


(Ben Manes) #1

The test cases for my gradle plugin do not pass with 1.4-rc-1 due to dependency resolution problems. The test cases simulate different dependency sets to evaluate them for upgrades.

The failure was due to an inability to parse the parent pom for com.google.inject:guice:2.0, claiming that it was not well-formed. I resolved this by changing the version to 1.0, which then led to either ModuleVersionNotFoundException for all of the dependencies or the inability to parse guava’s parent pom.

The plugin is small with tests, so it may be easiest for a Gradle developer to clone the repository and investigate. I can post stack traces otherwise.

P.S. I do use one internal api (LatestVersionSemanticComparator), but it fails prior to this usage.


#2

Thanks for the report. I’ve just been investigating a similar failure: GRADLE-2641. Are you saying that your issues exist even for a parent pom that does not have a SNAPSHOT version?

If you can post debug logs and stack traces it may help expedite things.


(Ben Manes) #3

Yes, here’s the debug log. An example error is,

[Fatal Error] oss-parent-7.pom:2:3: The markup in the document preceding the root element must be well-formed.
org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
 at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
 at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
 at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:153)
 at org.apache.ivy.util.XMLHelper.parseToDom(XMLHelper.java:196)
 at org.apache.ivy.plugins.parser.m2.PomReader.<init>(PomReader.java:95)
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.GradlePomModuleDescriptorParser.parseDescriptor(GradlePomModuleDescriptorParser.java:85)

#4

I’m not all that surprised you’re seeing that exception when trying to load ‘maven-metadata.xml’ or ‘pom.xml’ from ‘http://www.example.com’. I’m actually surprised that it worked with v1.3. We need to be more robust in handling bad content from servers, so this is a bug.

But I think the more important issue is the following exception, which indicates something going wrong in our caching code. We’ve done some work to make this faster in 1.4, including some custom serialisation, but I don’t yet understand how you’re exposing this problem. My guess is that if this issue were fixed, then the illegal markup exceptions would be just noise, and not effect the end result.

Caused by: org.gradle.api.internal.artifacts.ivyservice.ModuleVersionResolveException: Could not resolve org.sonatype.oss:oss-parent:7.
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.resolve(UserResolverChain.java:65) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LoopbackDependencyResolver$1.create(LoopbackDependencyResolver.java:69) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LoopbackDependencyResolver$1.create(LoopbackDependencyResolver.java:63) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.testfixtures.internal.InMemoryCacheFactory$InMemoryCache.useCache(InMemoryCacheFactory.java:98) ~[gradle-core-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:53) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LoopbackDependencyResolver.getDependency(LoopbackDependencyResolver.java:63) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.GradlePomModuleDescriptorParser.parseOtherPom(GradlePomModuleDescriptorParser.java:269) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.GradlePomModuleDescriptorParser.parseDescriptor(GradlePomModuleDescriptorParser.java:106) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.repositories.cachemanager.AbstractRepositoryCacheManager.parseModuleDescriptor(AbstractRepositoryCacheManager.java:80) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.repositories.cachemanager.DownloadingRepositoryCacheManager.cacheModuleDescriptor(DownloadingRepositoryCacheManager.java:149) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.parse(ExternalResourceResolver.java:226) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.getDependency(ExternalResourceResolver.java:189) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.repositories.resolver.MavenResolver.getDependency(MavenResolver.java:76) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ExternalResourceResolverAdapter.getDependency(ExternalResourceResolverAdapter.java:35) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CacheLockingModuleVersionRepository$1.run(CacheLockingModuleVersionRepository.java:50) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.testfixtures.internal.InMemoryCacheFactory$InMemoryCache.longRunningOperation(InMemoryCacheFactory.java:111) ~[gradle-core-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.longRunningOperation(DefaultCacheLockingManager.java:49) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CacheLockingModuleVersionRepository.getDependency(CacheLockingModuleVersionRepository.java:48) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleVersionRepository.getDependency(CachingModuleVersionRepository.java:88) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_37]
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_37]
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_37]
 at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_37]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.IvyContextualiser$1.invoke(IvyContextualiser.java:44) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at $Proxy25.getDependency(Unknown Source) ~[na:na]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain$RepositoryResolveState.resolve(UserResolverChain.java:185) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.findLatestModule(UserResolverChain.java:97) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.findLatestModule(UserResolverChain.java:80) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.resolve(UserResolverChain.java:54) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 ... 172 common frames omitted
Caused by: org.gradle.api.UncheckedIOException: java.io.NotSerializableException: org.gradle.api.internal.artifacts.ivyservice.dynamicversions.ModuleResolutionCacheEntry
 at org.gradle.api.internal.changedetection.InMemoryIndexedCache.put(InMemoryIndexedCache.java:52) ~[gradle-core-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.dynamicversions.SingleFileBackedModuleResolutionCache.cacheModuleResolution(SingleFileBackedModuleResolutionCache.java:64) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleVersionRepository.getDependency(CachingModuleVersionRepository.java:96) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_37]
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_37]
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_37]
 at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_37]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.IvyContextualiser$1.invoke(IvyContextualiser.java:44) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at $Proxy25.getDependency(Unknown Source) ~[na:na]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain$RepositoryResolveState.resolve(UserResolverChain.java:185) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.findLatestModule(UserResolverChain.java:97) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.findLatestModule(UserResolverChain.java:80) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.resolve(UserResolverChain.java:54) ~[gradle-core-impl-1.4-rc-1.jar:1.4-rc-1]
 ... 200 common frames omitted
Caused by: java.io.NotSerializableException: org.gradle.api.internal.artifacts.ivyservice.dynamicversions.ModuleResolutionCacheEntry
 at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164) ~[na:1.6.0_37]
 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330) ~[na:1.6.0_37]
 at org.gradle.api.internal.changedetection.InMemoryIndexedCache.put(InMemoryIndexedCache.java:49) ~[gradle-core-1.4-rc-1.jar:1.4-rc-1]
 ... 212 common frames omitted

(Ben Manes) #5

There is one test case that uses a bad repository, http://www.example.com. It is supposed to show that the analysis succeeds because a good repository, mavenCentral, is also included. The remaining test cases only use mavenCentral, so they shouldn’t have this type of failure, but do.


#6

Hmmm. I’m running the tests inside IntelliJ IDEA, and I only see the ‘well-formed’ exception for the execution of ‘Single project with good and bad repositories’. Are you sure you’re seeing the XML-related exception when running the other tests?

All of the other tests fail for me, but with a ‘NotSerializableException’. Looking at the stack-trace a little deeper, I think this is due to the use of ‘InMemoryIndexedCache’ which is used up by ‘ProjectBuilder’.


(Ben Manes) #7

Oh, you are correct. I tried it again without that test and only ModuleVersionNotFoundException occur


(Ben Manes) #8

Verified that the tests pass with 1.4-rc-2. Thanks!