Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reference javadocs to dependencies in Maven's eclipse plugin when javadoc not attached to dependency

I use Eclipse, Maven, and Java in my development. I use Maven to download dependencies (jar files and javadoc when available) and Maven's eclipse plug-in to generate the .project and .classpath files for Eclipse. When the dependency downloaded does not have attached javadoc I manually add a link for the javadoc in the .classpath file so that I can see the javadoc for the dependency in Eclipse. Then when I run Maven's eclipse plugin to regenerate the .classpath file it of course wipes out that change.

Is there a way to configure Maven's eclipse plug-in to automatically add classpath attributes for javadoc when running Maven's eclipse plug-in?

I'm only interested in answers where the javadoc and/or sources are not provided for the dependency in the maven repository, which is the case most often for me. Using downloadSources and/or downloadJavadocs properties won't help this problem.

like image 505
John in MD Avatar asked Sep 04 '08 18:09

John in MD


People also ask

How do I automatically add javadoc?

In the Package Explorer view, select a Java project and click Project > Generate Javadoc with Diagrams > Automatically. In the Generate Javadoc wizard, under Javadoc command, select the Javadoc command (an executable file).

How do I fix javadoc errors?

You need to call mvn javadoc:fix to fix main Java source files (i.e. inside src/main/java directory) or mvn javadoc:test-fix to fix test Java source files (i.e. inside src/test/java directory).

How do I disable javadoc and download sources in Eclipse?

You can disable this in the Maven configuration: Window > Preferences > Maven > Disable "Download Artifact Sources" and "Download Artifact JavaDoc". You can also run mvn install from the console, which often solves these kinds of problems and less prone to errors during downloading.


1 Answers

From the Maven Eclipse Plugin FAQ

The following example shows how to do this in the command-line:

mvn eclipse:eclipse -DdownloadSources=true  -DdownloadJavadocs=true  

or in your pom.xml:

<project>   [...]   <build>     [...]     <plugins>       [...]       <plugin>         <groupId>org.apache.maven.plugins</groupId>         <artifactId>maven-eclipse-plugin</artifactId>         <configuration>           <downloadSources>true</downloadSources>           <downloadJavadocs>true</downloadJavadocs>         </configuration>       </plugin>       [...]     </plugins>     [...]   </build>   [...] </project> 
like image 153
ddimitrov Avatar answered Nov 04 '22 20:11

ddimitrov