如何在Maven多模块项目中从Javadoc生成中排除单个模块?

wnavrhmk  于 2023-04-11  发布在  Maven
关注(0)|答案(3)|浏览(193)

我有一个这样的Maven多模块项目:

foo-parent
    foo-module
    foo-module-new
    foo-other-module1
    foo-other-module2
    pom.xml

当在foo-parent中调用mvn javadoc:aggregate时,我想从Javadoc生成中排除模块 foo-module
使用excludePackageNames参数通过包名进行排除在我的例子中不起作用,因为foo-module和foo-module-new具有相同的包名。

ergxz8rk

ergxz8rk1#

启动以下命令,仅为foo-other-module1foo-other-module2模块生成javadoc(注意:始终包含聚合器模块,在本例中为foo-parent):

mvn javadoc:aggregate -pl :foo-parent,:foo-other-module1,:foo-other-module2

自Maven 3.2.1起,您还可以从reactor中排除模块,因此上述简化为

mvn javadoc:aggregate -pl '!foo-module'
k97glaaz

k97glaaz2#

由于maven-javadoc-plugin:3.2.0,您可以使用skippedModules属性来提供要跳过的模块的逗号分隔列表。例如,以下配置将跳过foo-module模块:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-javadoc-plugin</artifactId>
  <reportSets>
    <reportSet>
      <id>aggregate</id>
      <configuration>
        <skippedModules>foo-module</skippedModules>
      </configuration>
    </reportSet>
  </reportSets>
</plugin>

或者,您可以使用maven.javadoc.skippedModules用户属性来实现相同的结果。

t3psigkw

t3psigkw3#

使用maven配置文件。
1.添加您的POM:

<profiles>
     <profile>
     <id>javadoc</id>
     <modules>
         <module>module_include_javadoc1</module>
         <module>module_include_javadoc2</module>
     </modules>        
     </profile>
   </profiles>

1.运行以下命令:

mvn javadoc:aggregate -Pjavadoc

相关问题