Javadoc archive doesn't get published to Maven

I am using the older ‘maven’ plugin because ‘maven-publish’ doesn’t work with the release plugin (townsfolk)

I create three archives. The main jar, a zip file containing an XML schema, and a jar with javadocs. The main jar and the schema zip are uploaded, but the javadocs are not. Unless I force it, the javadocs jar isn’t even created before the uploadArchives task runs. I find it odd that my “schemaZip” is included,but my javadocJar" is not.

The relevant gradle code looks like this:

configurations {





task schemaZip(type: Zip, dependsOn: schemaGen) {

from ‘build/Schemas’

include ‘*.xsd’

classifier ‘schema’


task javadocJar(type: Jar, dependsOn: javadoc) {

from javadoc.destinationDir

classifier ‘javadoc’


artifacts {

schema schemaZip

javadocs javadocJar


uploadArchives {

repositories {

mavenDeployer {

snapshotRepository(url: “http://dcm-maven-repo/libs-snapshot-local”)

repository(url: “http://dcm-maven-repo/libs-release-local”)




uploadArchives.dependsOn javadocJar

Figured it out. uploadArchives doesn’t upload “artifacts” it only uploads what is added to the “archives” configuration. Apparently the Zip task type adds the output to the “archives” configuration automatically, but the Jar task type doesn’t???


artifacts {

schema schemaJar

javadocs javadocJar

archives javadocJar


did the trick.

At most one Jar is automatically added to the ‘archives’ configuration, and if you apply the ‘java’ plugin, it will be that plugin’s ‘Jar’ task.

Wouldn’t it make sense to add additional jars automatically so long as as they have a unique classifier?

The new ‘maven-publish’ plugin realizes what we now consider the right strategy (every artifact has to be published explicitly). The old ‘maven’ plugin will go away at some point, and I don’t expect it to receive further changes.

Yes. I want to use the newer plugin, but it had issues with the release plugin that removes -SNAPSHOT from the jar name and results in the publish task not finding the jars at the path with the previous name.

I couldn’t get it to work. Presumably that can be fixed (I would love to see it fixed in 1.8) so that actual file created by the jar task is used instead of what it would have been before the tasks actually ran.

It’s probably a matter of adapting the release plugin to work with the maven-publish plugin.