DefaultProjectDependency_Decorated cannot be cast to ExternalModuleDependency


(Chris Jones) #1

After upgrading to milestone-7 from milestone-5, I’m sometimes seeing this error:

Execution failed for task ':bridge:pmdSetup'.
Cause: Could not resolve all dependencies for configuration ':bridge:pmdConf'.
Cause: org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency_Decorated cannot be cast to org.gradle.api.artifacts.ExternalModuleDependency

Other times, the build works just fine. The gradle code in question looks like this:

allprojects {
    configurations {
        pmdConf
    }
    dependencies {
        pmdConf 'net.sourceforge.pmd:pmd:4+'
        pmdConf 'org.jaxen:jaxen:1+'
        pmdConf 'org.objectweb:asm:3+'
    }
}
  // Load the taskdefs for PMD and CPD.
task pmdSetup {
    doLast {
        ant {
            taskdef(name: 'pmd', classname: 'net.sourceforge.pmd.ant.PMDTask',
                    classpath: configurations.pmdConf.asPath)
            taskdef(name: 'cpd', classname: 'net.sourceforge.pmd.cpd.CPDTask',
                    classpath: configurations.pmdConf.asPath)
        }
    }
}

When it dies, it dies on the first of those two ant taskdefs.


(Dan Stine) #2

Looks like GRADLE-2010, fixed in upcoming 1.0-milestone-8.


(Chris Jones) #3

Yes, that certainly looks like the same thing. Thanks!