Hi Gradle experts,
We have a number of Maven and Gradle projects here and I thought it is a good idea to use mavenLocal()
to consume artifacts generated by Maven (especially those under development). Now I’m confronted with an issue regarding classifier
dependency resolution within Gradle.
We’ve got a library project (let’s call it sample-library
) that produces two artifacts. The first one is the main artifact and the second one contains only the projects resources (src/main/resources
) thus has classifier resources
. Assume the local Maven repository is empty and a Maven projects demands com.acme:sample-library:0.0.10-SNAPSHOT
. ~/.m2/repository
now looks like this:
\---com/acme/sample-library
\---0.0.10-SNAPSHOT
maven-metadata-nexus.xml
maven-metadata-nexus.xml.sha1
resolver-status.properties
sample-library-0.0.10-20151023.123304-1.jar
sample-library-0.0.10-20151023.123304-1.jar.sha1
sample-library-0.0.10-20151023.123304-1.pom
sample-library-0.0.10-20151023.123304-1.pom.sha1
sample-library-0.0.10-SNAPSHOT.jar
sample-library-0.0.10-SNAPSHOT.pom
_remote.repositories
Afterwards in our Gradle project, we consume only the resources artifact com.acme:sample-library:0.0.10-SNAPSHOT:resources
. When building the project I got the following error message:
:compileJava
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not find sample-library-resources.jar (com.acme:sample-library:0.0.10-SNAPSHOT).
Searched in the following locations:
file:/C:/Users/user.home/.m2/repository/com/acme/sample-library/0.0.10-SNAPSHOT/sample-library-0.0.10-SNAPSHOT-resources.jar
The build.gradle
contains repository configuration for our corporate Nexus instance:
repositories {
mavenLocal()
maven {
url "$nexus/groups/company"
credentials {
username nexusUsername
password nexusPassword
}
}
maven {
url "$nexus/groups/public"
credentials {
username nexusUsername
password nexusPassword
}
}
}
As Nexus contains the required (classifier) artifact, I expect Gradle to download the artifact if it cannot be found in mavenLocal()
.
Is this a bug?