It seems that applying the Groovy plugin to a project which has a dependency with a classifier somehow breaks dependency resolution.
Consider this simple example buildscript:
apply plugin: 'java'
apply plugin: 'groovy'
repositories {
mavenCentral()
}
dependencies {
compile 'org.codehaus.groovy:groovy:2.4.4:grooid'
}
If a build is attempted with this buildscript (and an empty Groovy source file to trigger the compilation) something quite strange happens:
:clean UP-TO-DATE
:compileJava UP-TO-DATE
:compileGroovy
Download https://repo1.maven.org/maven2/org/codehaus/groovy/groovy/2.4.4/groovy-2.4.4-grooid.jar
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration 'detachedConfiguration1'.
> Could not find org.codehaus.groovy:groovy:2.4.4-grooid.
Searched in the following locations:
https://repo1.maven.org/maven2/org/codehaus/groovy/groovy/2.4.4-grooid/groovy-2.4.4-grooid.pom
https://repo1.maven.org/maven2/org/codehaus/groovy/groovy/2.4.4-grooid/groovy-2.4.4-grooid.jar
Required by:
com.example:GradleDepsProblem:1.0-SNAPSHOT
> Could not find org.codehaus.groovy:groovy-ant:2.4.4-grooid.
Searched in the following locations:
https://repo1.maven.org/maven2/org/codehaus/groovy/groovy-ant/2.4.4-grooid/groovy-ant-2.4.4-grooid.pom
https://repo1.maven.org/maven2/org/codehaus/groovy/groovy-ant/2.4.4-grooid/groovy-ant-2.4.4-grooid.jar
Required by:
com.example:GradleDepsProblem:1.0-SNAPSHOT
* 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.031 secs
The first time dependency resolution is attempted it succeeds.
Download https://repo1.maven.org/maven2/org/codehaus/groovy/groovy/2.4.4/groovy-2.4.4-grooid.jar
That URL is correct, the download succeeds, and the JAR ends up in the Gradle caches when the download is complete.
What happens next is Gradle then attempts to resolve that same dependency again, however this time it gets the URL wrong, and is now treating the classifier as part of the version, which obviously fails. It also says it was the configuration ‘detachedConfiguration1’ for which it could not resolve the dependencies, but I haven’t created a detached configuration (or any additional configurations) and I’m only applying core language plugins.
Is there something I’ve missed here or is this looking like a bug?