[GRADLE-2010] DefaultProjectDependency_Decorated cannot be cast to ExternalModuleDependency Created: 21/Dec/11  Updated: 04/Jan/13  Resolved: 06/Jan/12

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

Type: Bug
Reporter: Anders Viskum Assignee: Adam Murdoch
Resolution: Fixed Votes: 3


 Description   

Once in a while our Gradle build fails with following error (aprox. every 4th build):

  • What went wrong:
    Could not resolve all dependencies for configuration ':shared:compile'.
    Cause: org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency_Decorated cannot be cast to org.gradle.api.artifacts.ExternalModuleDependency

Its after upgrading to milestone-6. It happens both on my Windows work machine and on out Jenkins build server.

Full st:
aviskum@bp-dev-9 /cygdrive/l/portal
$ gradle clean build --stacktrace
:client:clean
:modules:clean
:server:clean
:service:clean
:shared:clean
:webservices:clean
:wsdl:clean
:clean
:service:compileJava
:service:processResources UP-TO-DATE
:service:classes
:service:jar
:shared:compileJava

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not resolve all dependencies for configuration ':shared:compile'.
    Cause: org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency_Decorated cannot be cast to org.gradle.ap
    i.artifacts.ExternalModuleDependency
  • Try:
    Run with --info or --debug option to get more log output.
  • Exception is:
    org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':shared:compile'.
    at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.wrapException(ErrorHandl
    ingArtifactDependencyResolver.java:47)
    at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.access$000(ErrorHandling
    ArtifactDependencyResolver.java:26)
    at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$BrokenResolvedConfigurat
    ion.rethrowFailure(ErrorHandlingArtifactDependencyResolver.java:127)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(De
    faultConfiguration.java:495)
    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(De
faultFileCollectionResolveContext.java:187)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionR
esolveContext.java:102)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCo
llectionResolveContext.java:74)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileTreeConverter.convertInto(De
faultFileCollectionResolveContext.java:178)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionR
esolveContext.java:97)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCo
llectionResolveContext.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.ja
va: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(Defau
ltTaskArtifactStateRepository.java:88)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(D
efaultTaskArtifactStateRepository.java:128)
at org.gradle.api.internal.changedetection.ShortCircuitTaskArtifactStateRepository$ShortCircuitArtifactState.isU
pToDate(ShortCircuitTaskArtifactStateRepository.java:77)
at org.gradle.api.internal.changedetection.FileCacheBroadcastTaskArtifactStateRepository$1.isUpToDate(FileCacheB
roadcastTaskArtifactStateRepository.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(SkipEmptySourceFilesTaskExec
uter.java:41)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.j
ava:51)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.j
ava: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.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 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)
Caused by: java.lang.ClassCastException: org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency_Decorat
ed cannot be cast to org.gradle.api.artifacts.ExternalModuleDependency
at org.gradle.api.internal.artifacts.ivyservice.moduleconverter.dependencies.ExternalModuleDependencyDescriptorF
actory.getExternalModuleDependency(ExternalModuleDependencyDescriptorFactory.java:51)
at org.gradle.api.internal.artifacts.ivyservice.moduleconverter.dependencies.ExternalModuleDependencyDescriptorF
actory.createDependencyDescriptor(ExternalModuleDependencyDescriptorFactory.java:39)
at org.gradle.api.internal.artifacts.ivyservice.moduleconverter.dependencies.AbstractDependencyDescriptorFactory
Internal.addDependencyDescriptor(AbstractDependencyDescriptorFactoryInternal.java:49)
at org.gradle.api.internal.artifacts.ivyservice.moduleconverter.dependencies.AbstractDependencyDescriptorFactory
Internal.addDependencyDescriptor(AbstractDependencyDescriptorFactoryInternal.java:44)
at org.gradle.api.internal.artifacts.ivyservice.moduleconverter.dependencies.DefaultDependenciesToModuleDescript
orConverter.addDependencies(DefaultDependenciesToModuleDescriptorConverter.java:48)
at org.gradle.api.internal.artifacts.ivyservice.moduleconverter.dependencies.DefaultDependenciesToModuleDescript
orConverter.addDependencyDescriptors(DefaultDependenciesToModuleDescriptorConverter.java:41)
at org.gradle.api.internal.artifacts.ivyservice.moduleconverter.ResolveModuleDescriptorConverter.convert(Resolve
ModuleDescriptorConverter.java:48)
at org.gradle.api.internal.artifacts.ivyservice.moduleconverter.PublishModuleDescriptorConverter.convert(Publish
ModuleDescriptorConverter.java:44)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder.resolve(DependencyGraphBuil
der.java:55)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver.resolve(DefaultDependenc
yResolver.java:69)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.call(CacheLockingArtifa
ctDependencyResolver.java:37)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.call(CacheLockingArtifa
ctDependencyResolver.java:35)
at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.withCacheLock(DefaultCacheLockingMana
ger.java:54)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtif
actDependencyResolver.java:35)
at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver.resolve(SelfResolvingDependencyR
esolver.java:42)
at org.gradle.api.internal.artifacts.ivyservice.ShortcircuitEmptyConfigsArtifactDependencyResolver.resolve(Short
circuitEmptyConfigsArtifactDependencyResolver.java:78)
at org.gradle.api.internal.artifacts.ivyservice.EventBroadcastingArtifactDependencyResolver.resolve(EventBroadca
stingArtifactDependencyResolver.java:37)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.resolve(ErrorHandlingArt
ifactDependencyResolver.java:36)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getResolvedConfiguration(DefaultConfigu
ration.java:234)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getResolvedConfiguration(Unkn
own Source)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(De
faultConfiguration.java:493)
... 56 more

BUILD FAILED

Total time: 6.451 secs

aviskum@bp-dev-9 /cygdrive/l/portal



 Comments   
Comment by Ryan J [ 30/Dec/11 ]

I've also been running into this on both Windows and Linux. For me it happens on the compileJava task of the first module to declare a project level dependency compile project(:raa-shared). Here is a snippet of a failed build:

[23:31:25]: :clean
[23:31:25]: :raa-shared:compileJava (2s)
[23:31:27]: [:raa-shared:compileJava] [ant:javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5
[23:31:27]: [:raa-shared:compileJava] [ant:javac] 1 warning
[23:31:27]: :raa-shared:processResources
[23:31:27]: :raa-shared:classes
[23:31:27]: :raa-shared:jar
[23:31:27]: :raa-client-shared:compileJava
[23:31:27]: FAILURE: Build failed with an exception.
[23:31:27]: * What went wrong:
[23:31:27]: Could not resolve all dependencies for configuration ':raa-client-shared:compile'.
[23:31:27]: Cause: org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency_Decorated cannot be cast to org.gradle.api.artifacts.ExternalModuleDependency

My environments:

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

Gradle build time: Thursday, November 17, 2011 5:54:12 o'clock 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.7.0_02 (Oracle Corporation 22.0-b10)
OS: Windows 7 6.1 x86

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

Gradle build time: Thursday, November 17, 2011 5:54:12 o'clock 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.7.0 (Oracle Corporation 21.0-b17)
OS: Linux 3.0.0-1-486 i386

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

Gradle build time: Thursday, November 17, 2011 5:54:12 o'clock 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.32-37-generic i386

Comment by Anders Viskum [ 02/Jan/12 ]

Could someone help with this issue? We are considering using another build tool because of this bug

Comment by Lari Hotari [ 02/Jan/12 ]

This bug affects also the grails build (master branch). The problem doesn't show up every time.

Comment by Adam Murdoch [ 02/Jan/12 ]

@anders, we're looking in to it. You might try running your build with java 6 as a work around.

Comment by Anders Viskum [ 03/Jan/12 ]

thx Adam - let me know if you need any help, e.g. my build file

Comment by Adam Murdoch [ 06/Jan/12 ]

This should be fixed now. Can you try the snapshot build from http://gradle.org/nightly ?

Comment by Anders Viskum [ 06/Jan/12 ]

It is fixed on gradle-1.0-milestone-8-20120106071535+0100. Thank you

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