【问题标题】:An error has occurred in JavaDocs report generation:Exit code: 1 - javadoc: error - invalid flag: -authorJavaDocs 报告生成发生错误:退出代码:1 - javadoc:错误 - 无效标志:-author
【发布时间】:2013-10-04 12:32:39
【问题描述】:

您好,我面临一些 maven 插件问题,当我尝试部署 java-webservices 项目时,我的项目没有下载 "maven-javadoc-plugin : 2.4" 插件,我手动将 "maven-javadoc-plugin 2.5" 版本 jar 安装到我的 .m2/repository 中。我得到了

"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>

Super POM : 已获得版本号,但不确定如何下载此 super 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

【问题讨论】:

  • 我只是添加了pom信息,请你看一下
  • 其实想想,你为什么用2.5?那是石器时代的材料。当前版本是2.9.1 - 你可以尝试使用它,看看错误是否仍然存在?
  • 是的,没错。但这是我的构建经理决定。即使我在本地尝试使用 2.9.1,也无济于事。

标签: java eclipse web-services maven


【解决方案1】:

我今天遇到了同样的问题,并通过向 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>

【讨论】:

    【解决方案2】:

    如果您正在编写一个 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);
    }
    

    【讨论】:

      【解决方案3】:

      问题是由本文概述的“doclint”引起的: https://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html

      在使用(无效的)@ 或 HTML java 文档时最常出现。

      将此添加到 maven-javadoc-plugin:

                         <configuration>
                             <doclint>none</doclint>
                         </configuration>
                  
      

      【讨论】:

        猜你喜欢
        • 2019-08-21
        • 2018-11-04
        • 2018-01-15
        • 1970-01-01
        • 2014-05-23
        • 2020-12-28
        • 2014-04-16
        • 1970-01-01
        相关资源
        最近更新 更多