Maven - Java EE 6 Web Profile Javadocs

2020-02-04 20:49发布

问题:

By declaring the following dependency:

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-web-api</artifactId>
    <version>6.0</version>
    <scope>provided</scope>
</dependency>

I can use about everything I need for a Java EE 6 Project (Servlet 3.0, JPA 2, EJB, CDI, etc). The problem is: Maven can not download the Javadocs for the dependency (or at least m2eclipse "Download JavaDoc" feature don't work), so Eclipse don't show me the Javadocs when I use the very handy code completion feature.

I've found this post specific to Servlet 3.0 API, Maven dependency for Servlet 3.0 API?.

Can anyone kindly point to a solution that works for every API? Or, can anyone please provide a dummy guide to install Java EE 6 Javadocs and link it to javaee-web-api artifact in the local repository?

回答1:

Assuming you have Java EE javadocs, you can install them to your local maven repository using the maven install plugin. Look at this usage link

You would use the -Dclassifier=sources to indicate you are installing sources. See this example for this.