Maven Javadoc 插件 javadoc-bundle-options

Posted

技术标签:

【中文标题】Maven Javadoc 插件 javadoc-bundle-options【英文标题】:Maven Javadoc Plugin javadoc-bundle-options 【发布时间】:2015-09-21 16:15:21 【问题描述】:

我在 pom.xml 中定义了插件如下:

<plugin>
                       <groupId>org.apache.maven.plugins</groupId>
                       <artifactId>maven-javadoc-plugin</artifactId>
                       <version>2.10.3</version>
                       <configuration>
                             <doclet>BADoclet</doclet>
                             <docletPath>$basedir</docletPath>
                             <additionalparam>-b4atarget B4AWrapper_$inAppVersion.xml</additionalparam>
                             <failOnError>false</failOnError>
                             <outputDirectory>$basedir</outputDirectory>
                             <detectOfflineLinks>false</detectOfflineLinks>
                       </configuration>
                       <executions>
                             <execution>
                                    <goals>
                                           <goal>javadoc</goal>
                                           <goal>test-javadoc</goal>
                                    </goals>
                                    <phase>site</phase>
                                    <configuration>
                                           <!-- Specific configuration for the given reports ... -->
                                    </configuration>
                             </execution>
                       </executions>
                </plugin>

运行 javadoc:javadoc 目标时出现以下错误:

命令行是:“C:\Program Files\Java\jdk\jre..\bin\javadoc.exe” @options @packages

参考生成的Javadoc文件 'C:\work\workspace\B4AWrapper\target\site\apidocs' 目录。

   at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.executeJavadocCommandLine(AbstractJavadocMojo.java:5163)
   at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.executeReport(AbstractJavadocMojo.java:2075)
   at org.apache.maven.plugin.javadoc.JavadocReport.generate(JavadocReport.java:130)
   at org.apache.maven.plugin.javadoc.JavadocReport.execute(JavadocReport.java:318)
   at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
   at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
   at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
   at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
   at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
   at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
   at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
   at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
   at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
   at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
   at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

执行后,我看到了

javadoc-bundle-options

在目标目录下创建目录

而且选项文件 (site/apidocs/options) 包含以下内容:

-linkoffline 'http://docs.oracle.com/javase/6/docs/api' 'C:/work/workspace/B4AWrapper/target/javadoc-bundle-options'

我需要以某种方式删除 C:/work/workspace/B4AWrapper/target/javadoc-bundle-options 以使一切正常。

有什么想法吗?

【问题讨论】:

【参考方案1】:

找到了解决办法: 将以下内容添加到插件声明中:

<useStandardDocletOptions>false</useStandardDocletOptions>

【讨论】:

以上是关于Maven Javadoc 插件 javadoc-bundle-options的主要内容,如果未能解决你的问题,请参考以下文章

如何从命令行禁用 Maven Javadoc 插件?

maven 常用插件总结

Maven打包生成源码包和Javadoc包

Maven JavaDoc 列出了两次类

maven项目打包和编译跳过单元测试和javadoc

打包Maven公共模块项目的JavaDoc和源码