Maven 3,maven-site-plugin,如何在多模块项目中配置reportPlugins
在 Maven 3 中,站点插件在报告方面发生了变化。
在 Maven 2 中,报告部分有一个“继承”元素。例如:
<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>
Maven 3 中是否存在报告插件继承?那么在maven 3中reportPlugins的继承行为是什么?有什么方法可以像maven 2继承的元素一样改变这种行为?
其次,该部分对站点插件下的reportPlugins中的插件配置有影响吗?或者是否必须在pluginManagement & 中重复配置?报告插件部分?此配置是否也必须在子模块中重复?
归根结底,我想在 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-->
我希望所有这些配置都继承到子模块。甚至是reportPlugins 部分。
目前,maven 3 可以实现所有这些功能吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来这可能并不完全可能。请参阅
maven-site-plugin此问题代码>.
据说现在它的工作方式就像你当时想要的那样,
自 2017 年发布的 Maven 3.5 起。
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.