我在我的pox.xml中添加了maven java doc plugin依赖项,如下所示
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
使用java版本1.8,但是当注释丢失或没有描述时,它会抛出警告而不是错误。 我希望它抛出错误,任何人都可以帮忙吗?提前致谢! 它在控制台中抛出了以下警告
7 warnings
[WARNING] Javadoc Warnings
[WARNING] javadoc: warning - Multiple sources of package comments found for package "javax.servlet"
[WARNING] javadoc: warning - Multiple sources of package comments found for package "javax.servlet.http"
[WARNING] C:\SOFTDEV\LPIS\LPISDEPT\WEBAPP\branches\DEVELOPMENT\web\lpis_web\src\main\java\ie\gov\agriculture\lpis\web\auth\servlet\LPISAuthenticationServlet.java:61: warning: no description for @throws
[WARNING] * @throws IOException
[WARNING] ^
[WARNING] C:\SOFTDEV\LPIS\LPISDEPT\WEBAPP\branches\DEVELOPMENT\web\lpis_web\src\main\java\ie\gov\agriculture\lpis\web\editcache\filter\attribute\EditFilterAttribute.java:32: warning: no description for @param
[WARNING] * @param currentEntityFilter
[WARNING] ^
[WARNING] C:\SOFTDEV\LPIS\LPISDEPT\WEBAPP\branches\DEVELOPMENT\web\lpis_web\src\main\java\ie\gov\agriculture\lpis\web\editcache\filter\factory\EntityFilter.java:19: warning: no description for @param
[WARNING] * @param projectId
[WARNING] ^
[WARNING] C:\SOFTDEV\LPIS\LPISDEPT\WEBAPP\branches\DEVELOPMENT\web\lpis_web\src\main\java\ie\gov\agriculture\lpis\web\editcache\filter\factory\EntityFilter.java:20: warning: no description for @param
[WARNING] * @param attributeValues
[WARNING] ^
[WARNING] C:\SOFTDEV\LPIS\LPISDEPT\WEBAPP\branches\DEVELOPMENT\web\lpis_web\src\main\java\ie\gov\agriculture\lpis\web\editcache\filter\factory\FilterFactory.java:40: warning: no description for @param
[WARNING] * @param parameter
[WARNING] ^
答案 0 :(得分:0)
如果要设置错误以使构建失败,您还可以使用failOnWarnings。
表格更多信息请参阅https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html#failOnWarnings
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<failOnWarnings>true</failOnWarnings>
</configuration>
</plugin>