Hi.

I created a simple test project that has just one class and a simple test
for it. I want to generate test coverage reports with maven-cobertura-plugin
and maven-surefire-report-plugin.

However, when i run "mvn clean site", the coverage that is generated shows
0%. If I then run "mvn site" again, the reports are generated properly. But
if I then change tests and run "mvn site" again, the test coverage stays the
same. To see actual coverage reports, I have to run "mvn clean site", and
then "mvn site" again. I tried this with both 2.1 and 2.0 versions of
maven-cobertura-plugin, and the symptoms are the same in both cases. I found
some discussions on the net about cobertura (or surefire) not seeing the
datafile properly. I tried workarounds I saw and still no effect, maybe I
misunderstood something. Seems to me that  reports are generated before the
instrumented tests run.



Here is the POM:



<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>

  <modelVersion>4.0.0</modelVersion>

  <groupId>cobertura-test</groupId>

  <artifactId>cobertura-test</artifactId>

  <version>0.0.1</version>

  <description>test of cobertura setup</description>

  <build>

    <plugins>

      <plugin>

        <artifactId>maven-compiler-plugin</artifactId>

        <version>2.0</version>

        <configuration>

          <source>1.5</source>

          <target>1.5</target>

        </configuration>

      </plugin>

      <plugin>

        <groupId>org.codehaus.mojo</groupId>

        <artifactId>cobertura-maven-plugin</artifactId>

        <version>2.0</version>

        <executions>

          <execution>

            <goals>

              <goal>clean</goal>

            </goals>

          </execution>

        </executions>

      </plugin>

      <plugin>

        <artifactId>maven-surefire-plugin</artifactId>

        <configuration>

          <forkMode>never</forkMode>

        </configuration>

      </plugin>

    </plugins>

  </build>

  <dependencies>

            <dependency>

      <groupId>junit</groupId>

      <artifactId>junit</artifactId>

      <version>3.8.2</version>

      <scope>test</scope>

    </dependency>

  </dependencies>

  <reporting>

    <plugins>

      <plugin>

        <groupId>org.codehaus.mojo</groupId>

        <artifactId>cobertura-maven-plugin</artifactId>

        <version>2.0</version>

      </plugin>

      <plugin>

        <artifactId>maven-javadoc-plugin</artifactId>

      </plugin>

      <plugin>

        <artifactId>maven-surefire-report-plugin</artifactId>

      </plugin>

    </plugins>

  </reporting>

</project>





Thanks in advance.



Regards,

Shevchenko Anton

E-mail: [EMAIL PROTECTED] <[EMAIL PROTECTED]>

Reply via email to