How maven plugin can aggregate information from sub-modules? - maven

I'm trying to develop Maven-3 reporting plugin that will have an aggregate option. When this option is set to true the plugin has collect data from sub-modules and build a report just once - in parent module. How can I do this and where I can find documentation about it? Maybe an example of such a reporting plugin? Pay attention, it's Maven-3.

Take a look at the Maven-JavaDoc-Plugin, the Maven-Source-Plugin and may be the maven-license-plugin but documentation you won't find. The source is the documentation ;-)

Related

how to find a complete list of available maven reports?

I am looking for a complete list of maven reports.
I found this maven documentation page : maven reports list , but others reports are available, dependencies check report for example, see dependencies check documentation.
Does someone know a page listing all available maven reports ?
Thanks.

When do I need the maven-compiler-plugin?

I understand that the maven-compiler plugin is used to compile the code. Some of my project does not have that plugin in the pom file? When is it required?
I am trying to answer my own question based on what I learned since posted this question. If this answer is correct or incorrect please comment. Thanks.
If this plugin is not defined, the Maven Super POM contains all the default plugins you will be using. It works fine for small and non-serious projects. However, the best practice is to define these plugins in a company-wise POM and so that when you upgrade maven, you would not end up using a different version of plugin.
Have a look at the Goals Overview Section in Apache Maven Compiler Plugin
The Compiler Plugin has two goals. Both are already bound to their proper phases within the Maven Lifecycle and are therefore, automatically executed during their respective phases.
You only have to add it if you want to change the default parameters

cobertura maven pluginGenerate aggregate reports does not work

I discovered generating aggregate reports in multi-module projects only works if the maven aggregator pom project is also the parent project for sub modules. This really does not work for a lot enterprise level projects in which maven aggregator is not always the parent.
Really appreciate any suggestions!
Cobertura is an inactive project. Check out JaCoCo as a viable replacement, and it supports aggregate.
But if the issue is related to the NPE you get, check out this: https://jira.codehaus.org/browse/MCOBERTURA-151. We're using 2.5.1 of that plugin w/ that patch applied and it allows us to build using aggregate, but the output isn't really aggregate.

The Issues Report Plugin does not retrieve metrics

I have a problem when I run the Issues Report Plugin on the multi-module project. I noted that the documentation indicated that the plugin is incompatible with this kind of project.
Nevertheless, I tried to run a sonar-runner dry run on one of the modules using its projectKey and projectName (retrieved from the widget Description). Unfortunately, the plugin has not retrieved metrics previously analyzed for this module. All anomalies are marked as new.
Is there a way to ensure I get the right values?
The dry run mode for SonarQube analyses on multi-module projects suffers from limitations, which are all fixed in the upcoming 3.6.1 version of SonarQube.
See the following ticket: https://jira.codehaus.org/browse/SONAR-4265
And just to be clear: the Issues Report Plugin does not export measures of metrics, it only exports issues.

maven lifecycle configuration

I'm playing with maven plugins, specifically i'm trying to develop a custom maven plugin for eclipse. All goes well, it builds from console ... etc until:`
"Plugin execution not covered by lifecycle configuration"
appears. I research and find this:
http://wiki.eclipse.org/M2E_plugin_execution_not_covered;
obviously i do not want to ignore the plugin's execution, the execute instruction does not seem to work, as for the delegate to project configurator, i am not able to find
AbstractJavaProjectConfigurator.java.
I've searched in org.eclipse.jdt , core and source but there is no reference to what i am searching, best match i could find was here:
http://git.eclipse.org/c/m2e/m2e-core.git/tree/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt
All in one, what i want to achive is this: "Starting with m2e 1.1, maven plugin developers are able to provide lifecycle mapping metadata as part of the plugin itself." as stated in the first link i inserted. Any help would be greatly appreciated.
To simply bypass the mojo execution or telling m2e to simply execute your mojo via maven embedder you need the following:
a proper lifecycle mapping as explained in your link. Reference: https://github.com/php-maven/maven-php-plugin/blob/master/ide-plugins/eclipse/tags/2.0.3/org.phpmaven.eclipse.core/lifecycle-mapping-metadata.xml
However I put it in the root of the eclipse project to be able to debug it (finding those extra resources sometimes failes if you put them in src folders).
A build properties to embedd it into build: https://github.com/php-maven/maven-php-plugin/blob/master/ide-plugins/eclipse/tags/2.0.3/org.phpmaven.eclipse.core/build.properties
Activation via dependencies and extension:
Hope this helps. I was confused about the project configurator too. But the above example does not require any project configurator.

Resources