Reputation: 193
I've searched for similar questions already asked, but most have been related to generating new java documentation using javadoc for all of the included dependencies.
My question is more basic - I just want to be able to view the javadoc documentation for an external library in Eclipse when using the "Ctrl+Space" or hovering over an object/method.
For example: I have a dependency for the "commons-cli" library
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.3</version>
</dependency>
By default though, I am not able to view the API documentation for the classes located in this library. I can do this manually, by using the Project Explorer to navigating to the "commons-cli-1.3.jar" file located in Java Resources->Library->Maven Dependencies and then specifying the URL (https://commons.apache.org/proper/commons-cli/apidocs/) for the javadoc in its property dialog box.
Is there a way to incorporate this information into the maven pom.xml file? That way, I don't have to do this manually for every dependency and also it works for anyone checking out my project to their own computer.
Thanks in advance.
Upvotes: 1
Views: 660
Reputation: 12136
Run mvn dependency:sources
which downloads the sources for the libraries. Check Maven repo dir (normally ~/.m2
) if you have sources there - there should be jar with the same name as the lib artifact but appended with -sources
. Like this:
If this is the case and you still don't see the javadocs in IDE then you should setup your IDE to use Maven repo as a source for sources.
Upvotes: 1