# withJavadocJar

abstract fun withJavadocJar()(source)

Enables generating a Javadoc artifact for the main feature of this project. If no components with a main feature are defined for this project, this has no effect.

Adds a task `javadocJar` that will package the output of the `javadoc` task in a JAR with classifier `javadoc`.

The produced artifact is registered as a documentation variant on the `java` component and added as a dependency on the `assemble` task. This means that if `maven-publish` or `ivy-publish` is also applied, the javadoc JAR will be published.

If the project already has a task named `javadocJar` then no task is created.

The publishing of the Javadoc variant can also be disabled using skip through withVariantsFromConfiguration, if it should only be built locally by calling or wiring the ':javadocJar' task.

#### Since

6.0