2013-10-04 34 views
7

當我嘗試部署java-webservices項目時,我正面臨一些Maven插件問題,我的項目沒有下載"maven-javadoc-plugin : 2.4"插件,我手動安裝"maven-javadoc-plugin 2.5"版本jar到我的.m2/repository中。我得到在JavaDocs報告生成中發生錯誤:退出代碼:1 - javadoc:錯誤 - 無效標誌:-author

"An error has occurred in JavaDocs report generation:Exit code: 1 - 
javadoc: error - invalid flag: -author". 

任何人可以幫助我這個錯誤,

孩子POM

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-javadoc-plugin</artifactId> 
    <executions> 
     <execution> 
      <goals> 
       <goal>javadoc</goal> 
      </goals> 
      <phase>compile</phase> 
     </execution> 
    </executions> 
    <configuration> 
     <encoding>UTF-8</encoding> 
     <verbose>false</verbose> 
     <show>public</show> 
     <subpackages>com.pubco.mp.emarket.services</subpackages> 
     <doclet>com.sun.jersey.wadl.resourcedoc.ResourceDoclet</doclet> 
     <docletArtifacts> 
      <docletArtifact> 
       <groupId>com.sun.jersey.contribs</groupId> 
       <artifactId>wadl-resourcedoc-doclet</artifactId> 
       <version>${jersey-client.version}</version> 
      </docletArtifact> 
      <docletArtifact> 
       <groupId>com.sun.jersey</groupId> 
       <artifactId>jersey-server</artifactId> 
       <version>${jersey-client.version}</version> 
      </docletArtifact> 
      <docletArtifact> 
       <groupId>xerces</groupId> 
       <artifactId>xercesImpl</artifactId> 
       <version>2.6.1</version> 
      </docletArtifact> 
     </docletArtifacts> 
     <additionalparam>-output ${project.build.outputDirectory}/resourcedoc.xml</additionalparam> 
    </configuration> 
</plugin> 

父POM:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-javadoc-plugin</artifactId> 
    <executions> 
     <execution> 
      <goals> 
       <goal>javadoc</goal> 
      </goals> 
      <phase>compile</phase> 
     </execution> 
    </executions> 
    <configuration> 
     <encoding>UTF-8</encoding> 
     <verbose>false</verbose> 
     <show>public</show> 
     <subpackages>com.pubco.mp.emarket.services</subpackages> 
     <doclet>com.sun.jersey.wadl.resourcedoc.ResourceDoclet</doclet> 
     <docletArtifacts> 
      <docletArtifact> 
       <groupId>com.sun.jersey.contribs</groupId> 
       <artifactId>wadl-resourcedoc-doclet</artifactId> 
       <version>${jersey-client.version}</version> 
      </docletArtifact> 
      <docletArtifact> 
       <groupId>com.sun.jersey</groupId> 
       <artifactId>jersey-server</artifactId> 
       <version>${jersey-client.version}</version> 
      </docletArtifact> 
      <docletArtifact> 
       <groupId>xerces</groupId> 
       <artifactId>xercesImpl</artifactId> 
       <version>2.6.1</version> 
      </docletArtifact> 
     </docletArtifacts> 
     <additionalparam>-output ${project.build.outputDirectory}/resourcedoc.xml</additionalparam> 
    </configuration> 
</plugin> 

超級POM :已經得到版本號,我不知道如何這個超級POM下載。

<maven-javadoc-plugin.version>2.5</maven-javadoc-plugin.version> 

<pluginExecution> 
    <pluginExecutionFilter> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-javadoc-plugin</artifactId> 
     <versionRange>[2.5,)</versionRange> 
     <goals> 
      <goal>javadoc</goal> 
     </goals> 
    </pluginExecutionFilter> 
    <action> 
     <execute/> 
    </action> 
</pluginExecution> 

完整的錯誤輸出:

1 error 
[INFO] 
------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] 
------------------------------------------------------------------------ 
[INFO] Total time: 23.959s 
[INFO] Finished at: Fri Oct 04 18:31:07 IST 2013 
[INFO] Final Memory: 16M/29M 
[INFO] 
------------------------------------------------------------------------ 
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-javadoc-plugin:2.5:javadoc (default) on 
project mpemarketservices-war: An error has occurred in JavaDocs 
report generation:Exit code: 1 - javadoc: error - invalid flag: -author 
[ERROR] 
[ERROR] Command line was:C:\jdk1.6.0_13\jre\..\bin\javadoc.exe @options 
[ERROR] -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 

[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 
+0

我只是添加甲醛信息,請你看看 –

+0

其實,細想起來,你爲什麼要使用2.5?這是石器時代的材料。目前的版本是2.9.1 - 你可以嘗試使用它,看看錯誤是否持續? – Mureinik

+0

是的,沒錯。但它是我的構建經理的決定。即使我在本地嘗試2.9.1,也沒有幫助。 –

回答

5

今天我有同樣的問題,並通過增加一個配置選項的Javadoc插件固定它:

<useStandardDocletOptions>false</useStandardDocletOptions> 

所以,最終配置看起來像這樣:

 <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-javadoc-plugin</artifactId> 
      <executions> 
       <execution> 
        <goals> 
         <goal>javadoc</goal> 
        </goals> 
        <phase>compile</phase> 
       </execution> 
      </executions> 
      <configuration> 
       <encoding>UTF-8</encoding> 
       <verbose>false</verbose> 
       <show>public</show> 
       <subpackages>com.pubco.mp.emarket.services</subpackages> 
       <doclet>com.sun.jersey.wadl.resourcedoc.ResourceDoclet</doclet> 
       <docletArtifacts> 
        <docletArtifact> 
         <groupId>com.sun.jersey.contribs</groupId> 
         <artifactId>wadl-resourcedoc-doclet</artifactId> 
         <version>${jersey-client.version}</version> 
        </docletArtifact> 
        <docletArtifact> 
         <groupId>com.sun.jersey</groupId> 
         <artifactId>jersey-server</artifactId> 
         <version>${jersey-client.version}</version> 
        </docletArtifact> 
        <docletArtifact> 
         <groupId>xerces</groupId> 
         <artifactId>xercesImpl</artifactId> 
         <version>2.6.1</version> 
        </docletArtifact> 
       </docletArtifacts> 
       <additionalparam>-output ${project.build.outputDirectory}/resourcedoc.xml</additionalparam> 
       <useStandardDocletOptions>false</useStandardDocletOptions> 
      </configuration> 
     </plugin> 
0

如果您正在編寫一個doclet,並希望它能夠使用標準選項,則可以使用optionLength來傳遞它們。

UmlGraphDoc doclet顯示如何將標準選項轉發到標準doclet,同時爲您的doclet保留所需的。

import com.sun.tools.doclets.standard.Standard; 

... 

/** 
* Option check, forwards options to the standard doclet, if that one 
* refuses them, they are sent to UmlGraph 
*/ 
public static int optionLength(String option) { 
    int result = Standard.optionLength(option); 
    if (result != 0) 
     return result; 
    else 
     return UmlGraph.optionLength(option); 
} 
相關問題