[GRADLE-2007] Gradle does not handle http responses with content-encoding = gzip Created: 19/Dec/11  Updated: 04/Jan/13  Resolved: 23/Jan/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-6
Fix Version/s: 1.0-milestone-8

Type: Bug
Reporter: Denis Zhdanov Assignee: Daz DeBoer
Resolution: Fixed Votes: 0


 Description   

Trying to build one of gradle samples. Output is below.

Googling reveals this topic and the last post mentions that patching ivy solves the problem. Also I've found old ticket that points to the similar problem - GRADLE-1101.

Tried to remove '~/.gradle/caches' but that didn't help.

The last note is that the problem happens not only with the artifact mentioned at the snippet below. I've checked it for three other resources and every of them shows the same error.

I'd suggest to do the following:

  • improve error reporting in order to allow to uniquely identify the problem if it happens again (e.g. file system path of the downloaded file (if any), problem file's region etc);
  • fix the problem;
denis@unit-240:~/dev/gradle/gradle-1.0-milestone-6/samples/java/multiproject$ clear; gradle -v; gradle build


------------------------------------------------------------
Gradle 1.0-milestone-6
------------------------------------------------------------

Gradle build time: Thursday, November 17, 2011 5:54:12 AM UTC
Groovy: 1.8.4
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.6.0_26 (Sun Microsystems Inc. 20.1-b02)
OS: Linux 2.6.38-10-generic amd64

:buildSrc:compileJava UP-TO-DATE
:buildSrc:compileGroovy UP-TO-DATE
:buildSrc:processResources UP-TO-DATE
:buildSrc:classes UP-TO-DATE
:buildSrc:jar UP-TO-DATE
:buildSrc:assemble UP-TO-DATE
:buildSrc:compileTestJava
Download http://repo1.maven.org/maven2/junit/junit/4.8.2/junit-4.8.2.pom
[Fatal Error] junit-4.8.2.pom:2:1: Content is not allowed in prolog.
org.xml.sax.SAXParseException: Content is not allowed in prolog.
	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249)
	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
	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.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser.parseDescriptor(PomModuleDescriptorParser.java:118)
	at org.jfrog.wharf.ivy.cache.WharfCacheManager$MyModuleDescriptorProvider.provideModule(WharfCacheManager.java:684)
	at org.jfrog.wharf.ivy.cache.ModuleDescriptorMemoryCache.getStale(ModuleDescriptorMemoryCache.java:67)
	at org.jfrog.wharf.ivy.cache.WharfCacheManager.getStaledMd(WharfCacheManager.java:701)
	at org.jfrog.wharf.ivy.cache.WharfCacheManager.cacheModuleDescriptor(WharfCacheManager.java:1038)
	at org.apache.ivy.plugins.resolver.BasicResolver.parse(BasicResolver.java:546)
	at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:266)
	at org.apache.ivy.plugins.resolver.IBiblioResolver.getDependency(IBiblioResolver.java:503)
	at org.gradle.api.internal.artifacts.repositories.MavenResolver.getDependency(MavenResolver.java:50)
	at org.gradle.api.internal.artifacts.ivyservice.UserResolverChain$ModuleResolution.resolveModule(UserResolverChain.java:326)
	at org.gradle.api.internal.artifacts.ivyservice.UserResolverChain.resolveLatestModule(UserResolverChain.java:110)
	at org.gradle.api.internal.artifacts.ivyservice.UserResolverChain.getDependency(UserResolverChain.java:74)
	at org.gradle.api.internal.artifacts.ivyservice.TopLeveResolverChain.getDependency(TopLeveResolverChain.java:60)
	at org.gradle.api.internal.artifacts.ivyservice.IvyResolverBackedDependencyToModuleResolver$DefaultModuleVersionResolver.getDescriptor(IvyResolverBackedDependencyToModuleResolver.java:79)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$ModuleVersionSelectorResolveState.resolve(DependencyGraphBuilder.java:559)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$DependencyResolvePath.resolveMetaData(DependencyGraphBuilder.java:649)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:130)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:58)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver.resolve(DefaultDependencyResolver.java:69)
	at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.call(CacheLockingArtifactDependencyResolver.java:37)
	at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.call(CacheLockingArtifactDependencyResolver.java:35)
	at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.withCacheLock(DefaultCacheLockingManager.java:54)
	at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:35)
	at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver.resolve(SelfResolvingDependencyResolver.java:42)
	at org.gradle.api.internal.artifacts.ivyservice.ShortcircuitEmptyConfigsArtifactDependencyResolver.resolve(ShortcircuitEmptyConfigsArtifactDependencyResolver.java:78)
	at org.gradle.api.internal.artifacts.ivyservice.EventBroadcastingArtifactDependencyResolver.resolve(EventBroadcastingArtifactDependencyResolver.java:37)
	at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.resolve(ErrorHandlingArtifactDependencyResolver.java:36)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getResolvedConfiguration(DefaultConfiguration.java:234)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getResolvedConfiguration(Unknown Source)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:493)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:204)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getFiles(Unknown Source)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileTreeConverter.convertInto(DefaultFileCollectionResolveContext.java:187)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:102)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:74)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileTreeConverter.convertInto(DefaultFileCollectionResolveContext.java:178)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:97)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:74)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileTreeConverter.convertInto(DefaultFileCollectionResolveContext.java:178)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:97)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:74)
	at org.gradle.api.internal.file.CompositeFileCollection$1.resolve(CompositeFileCollection.java:88)
	at org.gradle.api.internal.file.CompositeFileCollection.getSourceCollections(CompositeFileCollection.java:143)
	at org.gradle.api.internal.file.CompositeFileTree.getSourceCollections(CompositeFileTree.java:30)
	at org.gradle.api.internal.file.CompositeFileCollection.getFiles(CompositeFileCollection.java:38)
	at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:60)
	at org.gradle.api.internal.changedetection.DefaultFileSnapshotter.snapshot(DefaultFileSnapshotter.java:42)
	at org.gradle.api.internal.changedetection.InputFilesChangedUpToDateRule.create(InputFilesChangedUpToDateRule.java:35)
	at org.gradle.api.internal.changedetection.CompositeUpToDateRule.create(CompositeUpToDateRule.java:35)
	at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.calcCurrentState(DefaultTaskArtifactStateRepository.java:80)
	at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.isUpToDate(DefaultTaskArtifactStateRepository.java:88)
	at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(DefaultTaskArtifactStateRepository.java:128)
	at org.gradle.api.internal.changedetection.ShortCircuitTaskArtifactStateRepository$ShortCircuitArtifactState.isUpToDate(ShortCircuitTaskArtifactStateRepository.java:77)
	at org.gradle.api.internal.changedetection.FileCacheBroadcastTaskArtifactStateRepository$1.isUpToDate(FileCacheBroadcastTaskArtifactStateRepository.java:37)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:44)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
	at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:243)
	at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)
	at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)
	at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
	at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)
	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)
	at org.gradle.execution.DefaultBuildExecuter.access$300(DefaultBuildExecuter.java:23)
	at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:80)
	at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)
	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:63)
	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:157)
	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)
	at org.gradle.initialization.BuildSourceBuilder.createBuildSourceClasspath(BuildSourceBuilder.java:92)
	at org.gradle.initialization.BuildSourceBuilder.buildAndCreateClassLoader(BuildSourceBuilder.java:57)
	at org.gradle.initialization.SettingsHandler.findSettingsAndLoadIfAppropriate(SettingsHandler.java:84)
	at org.gradle.initialization.SettingsHandler.findAndLoadSettings(SettingsHandler.java:46)
	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:133)
	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)
	at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
	at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
	at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
	at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
	at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:233)
	at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:217)
	at org.gradle.launcher.Main.doAction(Main.java:48)
	at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53)
	at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51)
	at org.gradle.launcher.exec.Execution.execute(Execution.java:28)
	at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39)
	at org.gradle.launcher.Main.main(Main.java:39)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51)
	at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33)
	at org.gradle.launcher.GradleMain.main(GradleMain.java:24)

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve group:junit, module:junit, version:4.8.2.
Required by:
    :buildSrc:unspecified
Cause: java.text.ParseException: Content is not allowed in prolog.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 4.251 secs


 Comments   
Comment by Adam Murdoch [ 19/Dec/11 ]

This should be fixed. Can you try the 1.0-milestone-7 snapshot: http://forums.gradle.org/gradle/topics/gradle_1_0_milestone_7_snapshot_available

Comment by Denis Zhdanov [ 20/Dec/11 ]

Sorry but I get the same result within the milestone-7:

denis@unit-240:~/dev/gradle/gradle-1.0-milestone-6/samples/java/multiproject$ clear; gradle -v; gradle build

------------------------------------------------------------
Gradle 1.0-milestone-7-20111219065105+0100
------------------------------------------------------------

Gradle build time: Monday, December 19, 2011 5:51:05 AM UTC
Groovy: 1.8.4
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.6.0_26 (Sun Microsystems Inc. 20.1-b02)
OS: Linux 2.6.38-10-generic amd64

:buildSrc:clean
:buildSrc:compileJava
:buildSrc:compileGroovy UP-TO-DATE
:buildSrc:processResources UP-TO-DATE
:buildSrc:classes
:buildSrc:jar
:buildSrc:assemble
:buildSrc:compileTestJava
Download http://repo1.maven.org/maven2/junit/junit/4.8.2/junit-4.8.2.pom
[Fatal Error] junit-4.8.2.pom:2:1: Content is not allowed in prolog.
org.xml.sax.SAXParseException: Content is not allowed in prolog.
	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249)
	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
	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:105)
	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DownloadingRepositoryCacheManager.parseModuleDescriptor(DownloadingRepositoryCacheManager.java:170)
	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DownloadingRepositoryCacheManager.cacheModuleDescriptor(DownloadingRepositoryCacheManager.java:146)
	at org.apache.ivy.plugins.resolver.BasicResolver.parse(BasicResolver.java:546)
	at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:266)
	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DependencyResolverAdapter$1.create(DependencyResolverAdapter.java:77)
	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DependencyResolverAdapter$1.create(DependencyResolverAdapter.java:74)
	at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:172)
	at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:107)
	at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.longRunningOperation(DefaultCacheLockingManager.java:57)
	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DependencyResolverAdapter.getDependency(DependencyResolverAdapter.java:74)
	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain$ModuleResolution.resolveModule(UserResolverChain.java:271)
	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain$ModuleResolution.findModule(UserResolverChain.java:208)
	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.findLatestModule(UserResolverChain.java:97)
	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.getDependency(UserResolverChain.java:73)
	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.IvyResolverBackedDependencyToModuleResolver$DefaultModuleVersionResolver.getDescriptor(IvyResolverBackedDependencyToModuleResolver.java:83)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$ModuleVersionSelectorResolveState.resolve(DependencyGraphBuilder.java:870)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$DefaultModuleRevisionResolveState.getDescriptor(DependencyGraphBuilder.java:606)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$DependencyEdge.calculateTargetConfigurations(DependencyGraphBuilder.java:309)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$DependencyEdge.attachToTargetConfigurations(DependencyGraphBuilder.java:285)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:119)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:55)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver.resolve(DefaultDependencyResolver.java:68)
	at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.create(CacheLockingArtifactDependencyResolver.java:36)
	at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.create(CacheLockingArtifactDependencyResolver.java:34)
	at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)
	at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:99)
	at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:49)
	at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:34)
	at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver.resolve(SelfResolvingDependencyResolver.java:42)
	at org.gradle.api.internal.artifacts.ivyservice.ShortcircuitEmptyConfigsArtifactDependencyResolver.resolve(ShortcircuitEmptyConfigsArtifactDependencyResolver.java:78)
	at org.gradle.api.internal.artifacts.ivyservice.EventBroadcastingArtifactDependencyResolver.resolve(EventBroadcastingArtifactDependencyResolver.java:37)
	at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.resolve(ErrorHandlingArtifactDependencyResolver.java:36)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getResolvedConfiguration(DefaultConfiguration.java:234)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getResolvedConfiguration(Unknown Source)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:493)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:204)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getFiles(Unknown Source)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileTreeConverter.convertInto(DefaultFileCollectionResolveContext.java:187)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:102)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:74)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileTreeConverter.convertInto(DefaultFileCollectionResolveContext.java:178)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:97)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:74)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileTreeConverter.convertInto(DefaultFileCollectionResolveContext.java:178)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:97)
	at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:74)
	at org.gradle.api.internal.file.CompositeFileCollection$1.resolve(CompositeFileCollection.java:88)
	at org.gradle.api.internal.file.CompositeFileCollection.getSourceCollections(CompositeFileCollection.java:143)
	at org.gradle.api.internal.file.CompositeFileTree.getSourceCollections(CompositeFileTree.java:30)
	at org.gradle.api.internal.file.CompositeFileCollection.getFiles(CompositeFileCollection.java:38)
	at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:60)
	at org.gradle.api.internal.changedetection.DefaultFileSnapshotter.snapshot(DefaultFileSnapshotter.java:42)
	at org.gradle.api.internal.changedetection.InputFilesChangedUpToDateRule.create(InputFilesChangedUpToDateRule.java:35)
	at org.gradle.api.internal.changedetection.CompositeUpToDateRule.create(CompositeUpToDateRule.java:35)
	at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.calcCurrentState(DefaultTaskArtifactStateRepository.java:80)
	at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.isUpToDate(DefaultTaskArtifactStateRepository.java:88)
	at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(DefaultTaskArtifactStateRepository.java:128)
	at org.gradle.api.internal.changedetection.ShortCircuitTaskArtifactStateRepository$ShortCircuitArtifactState.isUpToDate(ShortCircuitTaskArtifactStateRepository.java:77)
	at org.gradle.api.internal.changedetection.FileCacheBroadcastTaskArtifactStateRepository$1.isUpToDate(FileCacheBroadcastTaskArtifactStateRepository.java:37)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:44)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
	at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:243)
	at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)
	at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)
	at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
	at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)
	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
	at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
	at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
	at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
	at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111)
	at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)
	at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109)
	at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:103)
	at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
	at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
	at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
	at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
	at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:152)
	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:108)
	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:76)
	at org.gradle.initialization.BuildSourceBuilder.createBuildSourceClasspath(BuildSourceBuilder.java:92)
	at org.gradle.initialization.BuildSourceBuilder.buildAndCreateClassLoader(BuildSourceBuilder.java:57)
	at org.gradle.initialization.SettingsHandler.findSettingsAndLoadIfAppropriate(SettingsHandler.java:84)
	at org.gradle.initialization.SettingsHandler.findAndLoadSettings(SettingsHandler.java:46)
	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:129)
	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:108)
	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:76)
	at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
	at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
	at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
	at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
	at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:238)
	at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:222)
	at org.gradle.launcher.Main.doAction(Main.java:48)
	at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53)
	at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51)
	at org.gradle.launcher.exec.Execution.execute(Execution.java:28)
	at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39)
	at org.gradle.launcher.Main.main(Main.java:39)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51)
	at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33)
	at org.gradle.launcher.GradleMain.main(GradleMain.java:24)

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve group:junit, module:junit, version:4.8.2.
Required by:
    :buildSrc:unspecified
Cause: java.text.ParseException: Content is not allowed in prolog.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8.587 secs
Comment by Denis Zhdanov [ 20/Dec/11 ]

I'm debugging the gradle processing now and see that the problem occurs exactly because gzip-ed resource is returned but gradle tries to work with it as with the plain one, i.e. 'Content-Encoding' response header is ignored.

You said that the milestone-7 is expected to solve the problem. Can you point me to the place at the gradle sources that is assumed to contain the fix?

Comment by Denis Zhdanov [ 20/Dec/11 ]

Btw, I've also made a workaround by hacking httpclient to use 'pragma: no-cache'. That made the wheels rolling again but the problem still persists at the gradle.

Comment by Denis Zhdanov [ 21/Dec/11 ]

Summary of the problem:

  1. When gradle is asked to resolve external maven-exposed library it downloads its descriptor at first;
  2. The descriptor may be returned at gzip format (http response contains 'Content-Encoding: GZIP' header). That is the case for Squid proxy;
  3. Gradle doesn't try to filter the returned data via gzip stream and tries to directly parse the pom;

Suggestion: modify org.gradle.api.internal.artifacts.repositories.transport.http.HttpGetResource#openStream() processing in a way to wrap returned stream to the GZIPInputStream if response headers indicate that the content is gzip-ed

Comment by Daz DeBoer [ 22/Dec/11 ]

We don't add an Accept-Encoding header to the HTTP request, so squid can assume that we accept all encodings. So squid is returning GZIP encoded content, and we don't handle it. The quick fix is for us to add 'Accept-Encoding: identity' to the request: then squid MUST send us the content unzipped. (see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3)
I'll try hard to get this into M7.

The full fix is for us to support Gzip encoding, adding it to our Accept-Encoding request header, and handling responses with 'Content-Encoding: gzip'.
This won't be done for M7.

Comment by Daz DeBoer [ 03/Jan/12 ]

Denis, if you're monitoring this, could you please try: http://repo.gradle.org/gradle/distributions-snapshots/gradle-1.0-milestone-7-20111228021828+0100-bin.zip
We are planning to release this snapshot as M7: it would be great to confirm that it fixes this issue.

Comment by Denis Zhdanov [ 04/Jan/12 ]

Will check that when return to the office (after the 10th January)

Generated at Wed Jun 30 12:10:15 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.