3

我有一组要为其生成 javadoc 的类,其中一些我想从已发布的 javadoc 中排除。结构如下:

com.company.package.classA
com.company.package.classB
com.company.package.subpackage.classC
com.company.package.subpackage.classD

我想排除“包”中的所有类并包括“子包”中的所有类。环境:

<excludePackageNames>com.company.package</excludePackageNames>

排除包下的所有子包。

除了重构代码,有没有办法做到这一点?

4

1 回答 1

1

您可以使用 maven-javadoc-plugin为您完成。

2.7 及更高版本支持此功能。

例子:

<plugin>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.8.1</version>
    <executions>
      <execution>
        <id>javadoc-jar</id>
        <phase>package</phase>
        <goals>
          <goal>jar</goal>
        </goals>
        <configuration>
          <!-- switch on dependency-driven aggregation -->
          <includeDependencySources>true</includeDependencySources>

          <dependencySourceExcludes>
            <!-- exclude ONLY commons-cli artifacts -->
            <dependencySourceExclude>commons-cli:*</dependencySourceExclude>
          </dependencySourceExcludes>
        </configuration>
      </execution>
    </executions>
  </plugin>


     <configuration>
          <!-- switch on dependency-driven aggregation -->
          <includeDependencySources>true</includeDependencySources>

          <dependencySourceIncludes>
            <!-- include ONLY dependencies I control -->
            <dependencySourceInclude>org.test.dep:*</dependencySourceInclude>
          </dependencySourceIncludes>
     </configuration>
于 2012-07-12T08:59:35.507 回答