开发者

Maven 3, maven-site-plugin, how to configure reportPlugins in a multi-module project

With Maven 3, the site plugin has changed regarding reporting.

In the maven 2, the reporting section had the an "inherited" element. For example:

<reporting>
  <plugins>开发者_运维知识库
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-failsafe-plugin</artifactId>
      <version>${failsafe.plugin.version}</version>
      <configuration>
        <useFile>false</useFile>
      </configuration>
      <inherited>true</inherited>
      <reportSets>
        <reportSet>
          <reports>
            <report>report-only</report>
          </reports>
        </reportSet>
      </reportSets>
    </plugin>
  </plugins>
</reporting>

Does report plugin inheritance exist in Maven 3? So in maven 3 what is the inheritance behavior for reportPlugins and is there any way to change this behavior like the maven 2 inherited element?

Secondly, does the section have any affect on plugin configurations in the reportPlugins under the site plugin? Or do configurations have to be duplicated in pluginManagement & reportPlugins sections? Does any of this configuration also have to be duplicated in submodules?

At the end of the day I'd like to do something like the following in Maven 3:

<!-- in parent pom -->
<build>
  <pluginManagement>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-failsafe-plugin</artifactId>
      <version>${failsafe.plugin.version}</version>
      <configuration>
        <useFile>false</useFile>
      </configuration>
      <reportSets>
        <reportSet>
          <reports>
            <report>report-only</report>
          </reports>
        </reportSet>
      </reportSets>
    </plugin>
  </pluginManagement>

  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-failsafe-plugin</artifactId>
      <!-- no version num or config - specified in pluginManagement section -->
    </plugin>  

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <configuration>
          <reportPlugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <!-- no version num, config, or report set - specified in pluginManagement section -->
            </plugin>  
          </reportPlugins>
        </configuration>
      </plugin>
  </plugins>
</build>

<!-- in sub module pom -->
<!-- specify nothing - already in parent pom-->

And I would like all of these configurations to be inherited to submodules. Even the reportPlugins section.

Is any/all of this possible with maven 3 currently?


It looks like this may not be completely possible. Refer to this issue in the maven-site-plugin.

It is supposedly now working just like you wanted back then, since Maven 3.5, released in 2017.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜