Affects Version/s: None
Fix Version/s: 2.5.1
Environment:Maven 3, Windows
Number of attachments :
I am evaluating upgrading my projects to use Maven 3.x, and I started to notice that some of my unit tests are failing when run as part of Cobertura, even though the same tests would pass without issues when they run under the regular "test" or "surefire" phases. It turns out that some of my tests have some depend on some static setup, so they would require to be run in separate JVMs, and this is usually accomplished by using <forkMode>always</forkMode> as part of the configuration of the surefire plugin. This worked fine with earlier versions of Maven, but started to break when trying Maven 3.x.
To verify the issue, I ran the same "mvn site" command twice on the same POM, with different versions of Maven, and here is what I found out:
- When using Maven 2.2.1, I can see that starting a new test will result in spawning a new JVM (I verified that using ProcessExplorer).
- When using Maven 3.0, I can see that the same JVM is being reused across the different unit tests.
Here are some of the relevant snippets from my POM:
<!-- from the build part -->
<!-- from the reporting part -->
I suspect that this has to do with the way the surefire plugin is being called from Cobertura.