要排除特定包,请使用<excludePackageNames/>参数,如下所示。该参数在其值中接受通配符 (*) 字符,但通配符应位于包名称的开头或结尾。如果要排除多个包,则每个包名称必须用冒号 (':')、逗号 (',') 或分号 (';') 分隔。(类似于Javadoc 工具)
例如,使用以下软件包:
com.mycompany.myapp com.mycompany.myapp.package1 com.mycompany.myapp.package1.subpackage1 com.mycompany.myapp.package1.subpackage2 com.mycompany.myapp.package1.subpackage3 com.mycompany.myapp.package1.util com.mycompany.myapp.package2 com.mycompany.myapp.package2.subpackage4 com.mycompany.myapp.package2.subpackage5 com.mycompany.myapp.package2.util com.mycompany.myapp.package3 com.mycompany.myapp.package3.subpackage6 com.mycompany.myapp.package3.subpackage6.subsubpackage1 com.mycompany.myapp.package3.subpackage6.subsubpackage2 com.mycompany.myapp.package3.subpackage7 com.mycompany.myapp.package3.util
您可以具有以下配置:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>3.3.2</version> <configuration> <!-- Exclude packages: com.mycompany.myapp.package1.subpackage1 com.mycompany.myapp.package1.subpackage2 com.mycompany.myapp.package1.subpackage3 com.mycompany.myapp.package1.util com.mycompany.myapp.package2 com.mycompany.myapp.package2.subpackage4 com.mycompany.myapp.package2.subpackage5 com.mycompany.myapp.package2.util com.mycompany.myapp.package3.util BUT include the packages: com.mycompany.myapp com.mycompany.myapp.package1 com.mycompany.myapp.package3 com.mycompany.myapp.package3.subpackage6 com.mycompany.myapp.package3.subpackage6.subsubpackage1 com.mycompany.myapp.package3.subpackage6.subsubpackage2 com.mycompany.myapp.package3.subpackage7 --> <excludePackageNames>com.mycompany.myapp.package1.*:com.mycompany.myapp.package2:com.mycompany.myapp.package2.*:*.util</excludePackageNames> </configuration> </plugin>