mavenjavadocmaven-javadoc-plugin

How to generate Javadoc for Maven Dependencies


I have a maven project with the following POM snippet:

<modelVersion>4.0.0</modelVersion>
<artifactId>Foo-Deploy</artifactId>
<name>Foo-Deploy</name>
<packaging>pom</packaging>
<description>foobar</description>
<dependencies>
<dependency>
        <groupId>de.foo.bar</groupId>
        <artifactId>some-api</artifactId>
        <version>${project.version}</version>
        <classifier>doc</classifier>
        <type>zip</type>
    </dependency>
</dependencies>

The idea is to have a dependency defined in which some sources are (this is created successfully before). Now I want to run javadoc on exactly THIS dependency. When I call

mvn javadoc:jar -DincludeDependencySources=true -DdependencySourceIncludes=de.foo.bar:some-api:*:doc:zip

it fails with the message

Not executing Javadoc as the project is not a Java classpath-capable package

what is wrong ? and would it work anyhow ?

or how can I generate javadoc from a specific dependency (assuming this project has more dependencies) ?

Thanks


Solution

  • To generate javadoc for dependent sources, a sequence of steps needs to be done. These are outlined in this link.

    Essentially you need to ensure that the source files of the dependency is generated/available and <includeDependencySources> parameter is enabled.