forkMode is ignored when generating cobertura reports using Maven 3
-------------------------------------------------------------------

                 Key: MCOBERTURA-132
                 URL: http://jira.codehaus.org/browse/MCOBERTURA-132
             Project: Maven 2.x Cobertura Plugin
          Issue Type: Bug
         Environment: Maven 3, Windows
            Reporter: Firass Shehadeh


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 -->
                <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.6</version>
                        <configuration>
                                <forkMode>always</forkMode>
                                
<redirectTestOutputToFile>true</redirectTestOutputToFile>
                                <includes>
                                        <include>**/*Test.java</include>
                                </includes>
                        </configuration>
                </plugin>

                <!-- from the reporting part -->
                <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-report-plugin</artifactId>
                        <version>2.6</version>
                </plugin>
                <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>cobertura-maven-plugin</artifactId>
                        <version>2.4</version>
                        <configuration>
                                <formats>
                                        <format>html</format>
                                        <format>xml</format>
                                </formats>
                        </configuration>
                </plugin>


I suspect that this has to do with the way the surefire plugin is being called 
from Cobertura.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to