Issue
I have a project structure like this:
Parent Project
- A
- B
- C
- D (Parent to D.1-3)
- D.1
- D.2
- D.3
-E
ABCE are code projects (OSGi bundles) that also contain unit tests, D.1, D.2, D.3 are integration tests using pax-exam that start using a jUnit runner.
ABCE unit tests can be run in parallel. D.1-3 can not be run in parallel. This is easy, I simply tell surefire in my parent pom to run everything in parallel, and in D's pom I tell surefire to run everything one at a time. D.1-3 have D as parent pom.
Ok, so now I have parallel test execution. I also really want parallel builds.
If I use the -T 5 flag in maven this means run several modules in parallel. When it comes to surefire this means I'll have 5 instances of surefire each running its own tests in parallel. This is also fine.
The problem is that maven may decide to run D.1, D.2, D.3 in parallel, and then those testcases will run in parallel no matter what I tell surefire.
Is there any way to override the -T flag of maven inside the D.pom?
Or any other way to force part of the build to go serialized? Other than moving D.1-3 out of this project and into another that is always run with -T 1.
Solution
have a look at: maven invoker plugin
it allows for launching maven within itself via configuration in a .properties file. Thus, it would be possible to build projects D.x separately with desired -T setting.
Answered By - lukasz-wolski
Answer Checked By - Gilberto Lyons (JavaFixing Admin)