mavenmaven-site-plugin

Maven skip site/reporting for module


I have a multi-module project and in the parent pom, I have several reporting plug-ins defined. Some of the modules contain code that does not need to have the reporting plugins run against them and I do not need them included in the generated site. Is there a way I can tell Maven to ignore them at the parent pom level?

Update:

Based on ajozwik's answer I added the skip configuration. My POMs now look like the following...

parent/pom.xml
<modules>
  <module>service</module>
  <module>client</module>
</modules>
<reporting>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-checkstyle-plugin</artifactId>
      <version>2.9.1</version>
    </plugin>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>findbugs-maven-plugin</artifactId>
      <version>2.4.0</version>
    </plugin>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-javadoc-plugin</artifactId>
      <version>2.8.1</version>
    </plugin>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>cobertura-maven-plugin</artifactId>
      <version>2.5.1</version>
      <configuration>
        <formats>
          <format>html</format>
        </formats>
      </configuration>
    </plugin>
  </plugins>   
</reporting>

client/pom.xml

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-site-plugin</artifactId>
      <version>3.1</version>
      <configuration>
        <skip>true</skip>
        <skipDeploy>true</skipDeploy>
      </configuration>
    </plugin>
  </plugins>
</build>

When I execute:

mvn clean package site

The build succeeds and the client's target directory does not contain the generated site. When I run:

mvn clean package site site-stage

In order to stage the site, it stages the site correctly. Without the skipDeploy tag, the staging would fail...


Solution

  • Have you tried (in child pom)?:

           <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-site-plugin</artifactId>
              <version>3.1</version>
              <configuration>
                    <skip>true</skip>
              </configuration>
            </plugin>
    


    Update. You can use property to redefine default behavior. Keep your children poms simple.
    In parent pom set (pluginManagement or plugins section)

     <properties>
        <maven-site-plugin.skip>false</maven-site-plugin.skip>
     </properties>
    
       <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.1</version>
          <configuration>
                <skip>${maven-site-plugin.skip}</skip>
          </configuration>
        </plugin>
    

    In parent pom just redefine maven-site-plugin.skip:

    <properties>
        <maven-site-plugin.skip>true</maven-site-plugin.skip>
     </properties>