当Javadoc标记不完整时,Maven无法在Java 8中工作 | ICHARM

首页 » 博文 » 踩坑 » 正文

当Javadoc标记不完整时,Maven无法在Java 8中工作

问题描述

执行Maven install时提示,下面类似错误:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.026s
[INFO] Finished at: Mon Apr 08 21:06:17 CEST 2013
[INFO] Final Memory: 27M/437M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.9:jar (attach-javadocs) on project jpc: MavenReportException: Error while creating archive:
[ERROR] Exit code: 1 - /Users/sergioc/Documents/workspaces/heal/jpc/src/main/java/org/jpc/engine/prolog/PrologDatabase.java:10: error: @param name not found
[ERROR] * @param terms the terms to assert
[ERROR] ^
[ERROR] /Users/sergioc/Documents/workspaces/heal/jpc/src/main/java/org/jpc/engine/prolog/PrologDatabase.java:11: warning: no description for @return
[ERROR] * @return
[ERROR] ^

大概的意思是在@标签附近的错误导致javadoc执行失败。

解决方案

原因是 Java8推出了DocLint的新特性,用来检测Javadoc中的错误,所以最好的方法是修复javadoc的标签错误,但是由于哀差闷所在的项目复杂,且其他人使用的是Ecplise+java7,而我使用的是Idea+java8,所以最快速的方法是阻止Maven使用DocLint,步骤如下:

依次打开 File – settings – Build, Execution, Deploumen – Build Tools – Maven – Runner

在VM Options: 中输入 -Dadditionalparam=-Xdoclint:none 

参考

Maven is not working in Java 8 when Javadoc tags are incomplete

发表评论