cobertura maven pluginGenerate aggregate reports does not work - maven

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.

Related

Edit Java source code before compile

I am new to gradle. I am looking forward to migrating from maven to gradle.
I had few requirements:
Existing project is maven based, and is generating a fat jar/uber jar. I am planning to split this into multiple projects, and creating smaller/thinner jars/libraries
I am currently evaluating the Multi-project Build support.
I have to also edit the Java source code, automatically, like making the java source modifications based on certain conditions
Publish the project as maven based, as other projects which need these split-up jars are still maven based.
I suppose Maven plugin can be used for publishing?
Would Gradle be a good, scalable solution for these two requirements which I am looking into currently?
Also please provide some pointers around these two topics.
Gradle has very good multi-project support, far better than Maven's. You can start with this documentation section
You can setup compilation of generated/auto-edited sources as well. Take a look at this forum post, discussing compilation of sources created from database using hbm2dao
You can setup publishing of projects using the Maven plugin. pom.xml files will be generated automatically

How to do continuous integration with Hudson for Maven 3 multi-module projects well?

It is my current impression that is impossible to do CI for a Maven 3 multi-module project well using Hudson (or Jenkins).
The situation seems to be that you have 2 realistic options of building a multi-module Maven 3 project with Hudson:
A freestyle project can also Build Maven projects, and with the incremental/recursive option it apparently should be able to deal with building only the necessary subtrees of the complete project tree.
A legacy, severly deprecated, with lots of warnings, Maven2/3 legacy build.
With the first option there is the significant disadvantage that your complete project looks like one big blob in Hudson, there is no visibility on the individual subprojects and there is no option for building individual subprojects and their dependees.
With the second option you have to basically swallow very little faith inducing warnings about legacy and "do not use" in order to find out that yes, it will build your multi-module project but the functionality of triggering subproject builds is completely broken and there is no intention of fixing this.
The only alternative I can figure out is to revert to Maven 2 for the build on the server, in which case the legacy plugin seems to work and even the individual sub-project builds can be triggered. But then I'm stuck on Maven 2.
I find my requirements to be rather conservative but I am completely stymied by the lack of Maven support in Hudson/Jenkins. Here's what I would expect:
ability to recognize multi-module projects and build them using Maven 3
ability to have "incremental" builds of such a multi-module project (i.e. only changed modules and its dependees)
ability to see the current status of the multi-module project and what sub-module has failed/succeeded/is unstable
The Maven project in question consists of about 84 Maven modules in a multi-module configuration with a common parent and a split into different subsystems. We are using Hudson 3.1.0.
Do I have any chance of achieving this?
Yes, it is impossible to do it well with the current Maven 2/3 project type.
I have done it well enough using a matrix / multi-configuration project type, and adding a "Module" axis manually. The configuration of the matrix job is a pain, and you have to remember to update your axis any time you add, remove or rename a module. But once configuration is complete, this solution works well for building. You can see the build and test results for each module separately, or integrated under the matrix job.
My colleague has been working on implementing Maven 3 multi-module functionality in Jenkins.
https://github.com/adamcin/maven-plugin
Not sure what the upstream acceptance status is.

Generating dependency charts for Maven

Are there any good tools that can scan many levels into maven projects / subprojects and generate reports or charts about all of the dependencies, version discrepancies between the same packages in different projects, etc etc?
Is there some other smart way to manage large maven projects that have several layers of subprojects with a large number of dependencies in each one?
Get a repository manager like Nexus, use the Maven Dependency plugin, use Sonar, use Hudson/Jenkins, check out Sonatype Insight and the Insight for CI plugin, use the dependency viewer in Eclipse, use a parent pom for your organization to centralize dependency versions and so on. Lots to do for you.
You can use Jenkins. It has got all you need to do with a maven project.
Jenkins with sonar the best combination for managing huge maven projects.
Depending on how "deep" you want to go, the maven site builds can use the reporting plugins to generate much of what you want. If you want much more info, then something like Sonar is probably more of what you want.
The simplest solution is to use the maven-dependency-plugin which can produce reports either ASCII or in different formats. Or you use the dependency-hierarchy in your IDE (m2e Plugin Eclipse) to look into the dependencies.

Maven Grouping Dependencies without installing pom

I have a maven project which has multiple profiles and lots of dependencies which are specific to each of those profiles. The current solution to clean this up works by creating an intermediate dependency pom for each profile which groups the dependencies together as described here in 3.6.1: http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-pom-best-practice.html Each of these dependency grouping poms lives in their own svn project and is build and deployed as a separate jenkins job.
The problem is that these poms, and the dependencies within them change and are released often and it has become difficult to maintain. Ideally, I would like all of the dependency management to live under one svn project and one build.
Any suggestions would be appreciated.
As khmarbaise writes, it would help with more information and an example.
However, just answering your actual question, how to get all your depenency grouping poms as one project and one build. It sound as if a multi module project with each module being one of your "dependency grouping pom" projects would be what you are looking for.
The Maven Release Plugin did what we needed.

what is the use of Maven in seleniumRC or WebDriver?

Can anyone explain me, for what purpose we will use Maven with seleniumRC or WebDriver? Is it like ANT - build.xml?
Your help will kindly appreciated!!
Thanks,
mra
Maven's original purpose was to handle transitive dependency management, so a developer needed only specify their "top-level" dependencies (e.g., I need Spring version n.n and webdriver version x.y).
Those dependencies have their own dependencies. Resolving those manually for all but trivial projects is difficult and error-prone. Using Maven we can make things difficult and error-prone automatically.
Kidding aside, Maven provides a lot of functionality out-of-the-box that would make for a very large Ant build.xml. Maven does handle the build process, but it also downloads your dependencies, resolves transitive dependencies, runs your tests, generates reports and a project website, and a million other things through its plugins.
Check out the docs on the Maven web site, particularly the Maven in 5 Minutes page to get started.

Resources