Is there a way for a Maven project to inherit report configurations from a pom dependency?

I know that you can configure a section in the parent POM and apply it to submodules in a project with several modules. However, I would like to have a separate POM for reference as a dependency, so I can have a report configuration that I can β€œmix” with different projects without the need to replicate the report configuration in multiple projects. (See Dependent POM here: http://sonatype.com/books/maven-book/reference/pom-relationships-sect-pom-best-practice.html )

For example, for my Widget project, I have a parent POM (widget-parent) with two submodules, widget-core and widget-web. I would like to have a separate POM, static analysis, on which the widget element depends. static-analysis will have a block that will determine the Checkstyle and FindBugs reports. When I create a Widget, I would expect Checkstyle and FindBugs to run on widgets and widgets.

If your solution only works on a specific version of Maven, let me know. We have not upgraded to 3.x.

+4
source share
2 answers

With Maven 3, the reporting item in pom is gone and replaced with the configuration item for the site plugin. Then you can use the regular pluginManagement to determine the configuration that is used everywhere. In any case, I would suggest upgrading to Maven 3, and this gives you another good reason.

Update. The reporting item has been returned and works again with the latest versions of the site plugin.

+3
source

This supposedly works with Maven 3.5, which was released in spring 2017; see a related problem .

The configuration is defined in the plugins under <build><pluginManagement> will be used when <reporting> also now.

See the documentation for more information if you don’t know how plugin management in Maven works.

0
source

Source: https://habr.com/ru/post/1332435/


All Articles