Is there a cookbook to setup a multi-module Maven project?
So my most basically question is if I have to include the xradar configuration file in each module stripped down to only cover the submodules of this module? Or can I place one configuration file in the parent and reference in the module to this configuration? But then while generating a report for a particular module, It wont' find all sources. And If I do the report just from the parent, I have no access to the sources of all modules.
Anyone has some hints?
ndox might be able to help. The ugly (but easy) thing you can do is set up a quick and dirty shell or a Ant script to simply copy every sources in directory (let's say, to stay a little mavenish the target/xradar/src) and all the classes (target/xradar/classes), then run XRadar with those.
This way you will be able to analyse your project, using the 'audit-mode'... However, I completly agree, this is far from perfect. I'm slowly thinking to change stuff to have a real "multiproject" support, but it'll have to wait until 1.1 is release (so most likely in 1.2)
By using the maven-xradar-plugin you can have a report for each module but for the moment it's not possible to aggregate the reports in order to have only one.
You can declare the plugin only in the parent module then you will find the audits in each module.
I also really think that XRadar should give a multiproject aggregate report.
Theorically, if you just do with Maven a "copy every file to a directory" + "copy every classes to another" and "analyse those" that will do your "agregated analysis".. I do not know really well mvn API, but if you can iterate on available source directory and availaible classes directory, this could be really easy to implement...
I will try today to setup the parent report today. I will keep you posted.
Another way to do your stuff -but I didn't try it- is to execute all the reports plugin (pmd, checkstyle,...).
Then you execute the xradar plugin in aggregator mode :
I have done the following to copy all compiled classes of the modules to the parent project:
<fileset dir="dcs-model/target/classes" includes="**/*.class"/>
<fileset dir="dcs-ejbclient/target/classes" includes="**/*.class"/>
<fileset dir="dcs-ejb/target/classes" includes="**/*.class"/>
<fileset dir="dcs-ear/target/classes" includes="**/*.class"/>
<fileset dir="dcs-swing/target/classes" includes="**/*.class"/>
<fileset dir="dcs-swing-war/target/classes" includes="**/*.class"/>
<fileset dir="dcs-test/target/classes" includes="**/*.class"/>
<fileset dir="dcs-infrastructure/target/classes" includes="**/*.class"/>
and then executed xradar:
... but since this project is a POM-Project, XRadar plugin does nothing:
[INFO] dcs is a pom project : skipping Dynamic...
So what will resolve this issue:
- allow the <classDirectory> to be an array of <classDirectories>, then I do not need to copy in the class files from the modules
- provide a configuration option to force the XRadar Plugin from executing his reports in a POM-File.
Need to think about it. Normally in a pom project you don't have classes files, that's why the plugin didn't execute XRadar on those projects.
We maybe could add a parameter to execute the plugin in a "multimodule mode" and so let Xradar been executed in a pom projects with a list of classes. My fear is that I don't know how the plugins (ckjm, pmd,...) called by the xradar plugins will react...
Another way, longer but better I think, is to add an xslt that take the submodules reports and make an aggregate one.
Have you try the "aggregator" trick of my last post?
I have not yet tried out the "aggregator" mode, but this is only for one module since I can only specify one xml file for a particular report and not multiple ones for each module, right?
Yes but with some plugins (like pmd, but some others provide the same feature) you can specify to aggregate the report.
So you will only have a complete report at the root project.
if you have success pls. let me know - im highly interested in this topic too.