my build.gradle looks roughly like this:
apply plugin: 'maven-publish'
...
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allJava
}
task testsJar(type: Jar) {
classifier = 'tests'
from sourceSets.test.output
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc.destinationDir
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact testsJar
artifact javadocJar
}
}
repositories {
maven {
url ...
credentials { ... }
}
}
}
When I use ‘gradle publish’ the plugin uploads all four generated JARs and the POM to the specified URL, but it looks like the generated maven-metadata.xml file is incomplete. When I deploy the project via Maven there is a ‘’ element in ‘metadata.versioning’ that lists all the uploaded artifacts, but that element doesn’t exist when I deploy via the maven-publish gradle plugin.
e.g.
<snapshotVersion>
<classifier>tests</classifier>
<extension>jar</extension>
<value>0.0.1-20140505.143439-4</value>
<updated>20140505143439</updated>
</snapshotVersion>
This is no problem when your only dependency in another project is the main jar, but if you have a dependency on the tests.jar gradle will complain that it can’t resolve the dependency, because the tests.jar is not mentioned in the metadata.
Has anyone experienced similar issues? Is there a workaround? Is that simply not implemented yet? Any ideas how to resolve this?