如何在maven-javadoc-plugin中跳过测试api文档?

时间:2013-03-26 14:09:59

标签: maven-3 maven-site-plugin maven-javadoc-plugin

我想在执行'clean skip:skip'后,在我的'target / site'文件夹中跳过生成'testapidocs'文件夹,并进行以下配置。

构建配置:

<build>
<plugins>
    .................
       <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.2</version>
        </plugin>

    </plugins>
   .........
</build>

报告配置:

   <reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9</version>
        </plugin>
    </plugins>
</reporting>

当我运行'clean site:site'时,它会在'target'目录下创建以下文件夹:

目标/站点/ apidoc

target / site / testapidocs - 想跳过这个

1 个答案:

答案 0 :(得分:4)

Selective Javadocs Reports告诉我们

  

要有选择地运行Javadocs报告,您只需要包含您喜欢的Javadocs报告。如FAQ中所述,配置取决于所使用的<build/>代码或<reporting/>代码。

使用<build/>代码

<project>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.9</version>
        <configuration>
          <!-- Default configuration for all reports -->
          ...
        </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>
    </plugins>
  </build>
</project>

使用<reporting/>代码

<project>
  ...
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.9</version>
        <configuration>
          <!-- Default configuration for all reports -->
          ...
        </configuration>
        <reportSets>
          <reportSet>
            <id>default</id>
            <configuration>
              <!-- Specific configuration for the given reports -->
              ...
            </configuration>
            <reports>
              <report>javadoc</report>
              <report>test-javadoc</report>
            </reports>
          </reportSet>
          <reportSet>
            <id>aggregate</id>
            <configuration>
              <!-- Specific configuration for the given reports -->
              ...
            </configuration>
            <reports>
              <report>aggregate</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>
  ...
</project>

我希望这可能有所帮助。