我正在使用Eclipse Oxygen,但這也是Neon版本中的問題。我已經開始了新的Maven項目並選擇了webapp-javaee7原型。該項目的創建完成後,pom.xml中已配置是這樣的:如何解決問題Eclipse未在webapp-javaee7 archetype Maven項目中顯示javax.annotation包的Javadocs?
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
因此,JavaEE的認可的,API-7.0.jar添加到贊同庫。正如我從this post瞭解到的,jar文件包含Annotations包javax.annotation。
我已經將包javax.annotation導入到此項目中的一些類中,並使用了一些註釋。當我將鼠標懸停在某些註釋上時,我收到以下消息:Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.
當我嘗試在瀏覽器中打開「附加的」Javadoc時,出現警告對話框:The documentation location for (annotation name) has not been configured. For elements from libraries specify the Javadoc location URL on properties page of the parent JAR ...\target\endorsed\javaee-endorsed-api-7.0.jar
。
將源代碼或Javadoc附加到javaee-endorsed-api-7.0.jar是不可能的。
當我製作普通Java項目並使用javax.annotation包時,Javadocs按預期方式顯示。
如何解決這個問題,並讓Eclipse在此Maven項目中顯示用於javax.annotation包的Javadocs我正在處理?
謝謝。