Search code examples
mavenjavadoc

Why my Maven project automatic generate apidoc in target folder?


I didn't configurated maven-javadoc-plugin in my maven project pom.xml file,but when I run mvn install command,then generate apidoc?

configuration of pom.xml as follow :

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.security.oauth</groupId>
    <artifactId>spring-security-oauth-parent</artifactId>
    <version>2.0.3.RELEASE</version>
</parent>
<build>
    <finalName>webcnmobile</finalName>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <!-- web.xml is not mandatory since JavaEE 5 -->
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
    <testResources>
        <testResource>
            <directory>src/test/resources</directory>
            <filtering>true</filtering>
        </testResource>
    </testResources>
</build>

the spring-security-oauth-parent pom.xml see here


Solution

  • The javadoc plugin is configured in the parent pom that you are referencing (spring-security-oauth-parent). This means that you inherit this configuration and it automatically gets applied to your project.

    The configuration in the parent pom is as follows:

    <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <id>javadoc</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    

    This is then being applied to your project and hence you are getting javadoc generated.