Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 857
Emerson Avatar asked Mar 29 '11 09:03

Emerson


People also ask

How can you generate javadoc?

From the main menu, select Tools | Generate JavaDoc. In the dialog that opens, select a scope — a set of files or directories for which you want to generate the reference, and set the output directory where the generated documentation will be placed.

How do I write and generate javadoc in Eclipse?

Step 1 − Open eclipse, select the option Project →Generate Javadoc. Step 2 − Select the javadoc.exe file from the bin folder of java installation directory, select the destination folder for the generated java doc and select Next. finish button.


1 Answers

To generate javadoc for dependant 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.

like image 138
Raghuram Avatar answered Nov 16 '22 02:11

Raghuram