Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to skip test api docs in maven-javadoc-plugin?

I would like to skip generating 'testapidocs' folder in my 'target/site' folder after executing 'clean skip:skip' with following configuration.

Build Configuration:

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

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

Reporting Configuration:

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

When i ran 'clean site:site' it is creating the following folders under 'target' directory:

target/site/apidoc

target/site/testapidocs - would like to skip this one

like image 738
Jagadeesh Avatar asked Mar 26 '13 14:03

Jagadeesh


People also ask

How do I ignore a Java document?

The Maven Javadoc plugin has provided a maven. javadoc. skip option to skip the Javadoc generation.

How do I fix Javadoc errors?

You need to call mvn javadoc:fix to fix main Java source files (i.e. inside src/main/java directory) or mvn javadoc:test-fix to fix test Java source files (i.e. inside src/test/java directory).

What is Maven Javadoc plugin?

The Javadoc Plugin uses the Javadoc tool to generate javadocs for the specified project. For more information about the standard Javadoc tool, please refer to Reference Guide. The Javadoc Plugin gets the parameter values that will be used from the plugin configuration specified in the pom.

How do I publish a Javadoc?

In the Goals field, place javadoc:javadoc —this will tell Maven to generate the Javadoc documentation. Now go to the “Post-build Action” and tick the “Publish Javadoc” checkbox. This project is a multimodule project, so a separate subdirectory is generated for each module (core, services, web and so forth).


1 Answers

The Selective Javadocs Reports told us as

To run the Javadocs reports selectively, you need to include only the Javadocs reports that you prefer. As said in the FAQ, the configuration depends on the <build/> tag or <reporting/> tag used.

Using <build/> Tag

<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>

Using <reporting/> Tag

<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>

I hope this may help.

like image 50
Charlee Chitsuk Avatar answered Sep 30 '22 18:09

Charlee Chitsuk