Hello all,

I'm successfully using cobertura 1.8 with cobertura-maven-plugin 2.1 in a project where aspectj is also used. For those interested, these are the relevant parts of my pom.xml configuration:

<build>
        <plugins>
                <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-eclipse-plugin</artifactId>
                        <configuration>
                        <additionalProjectnatures>
        <projectnature>org.eclipse.ajdt.ui.ajnature</projectnature>
                        </additionalProjectnatures>
                        <buildcommands>
        <buildcommand>org.eclipse.ajdt.ui.ajbuilder</buildcommand>
                        </buildcommands>
                        <downloadSources>true</downloadSources>
                        </configuration>
                </plugin>
                <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                                <systemProperties>
                                        <property>
                        <name>net.sourceforge.cobertura.datafile</name>
                        <value>target/cobertura/cobertura.ser</value>
                                        </property>
                                </systemProperties>
                                <argLine>-Xmx256m</argLine>
                        <testFailureIgnore>true</testFailureIgnore>
                        </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                        <artifactId>aspectj-maven-plugin</artifactId>
                                <configuration>
                                <complianceLevel>1.5</complianceLevel>
                                </configuration>
                                <executions>
                                        <execution>
                                        <goals>
                                        <goal>compile</goal>
                                        <goal>test-compile</goal>
                                        </goals>
                                        </execution>
                        </executions>
                </plugin>
        </plugins>
</build>

<reporting>
        <plugins>
                <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>cobertura-maven-plugin</artifactId>
                </plugin>
                <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>aspectj-maven-plugin</artifactId>
                        <configuration>
                                <verbose>true</verbose>
                                <complianceLevel>1.5</complianceLevel>
                        </configuration>
                        <reportSets>
                                <reportSet>
                                        <reports>
                                        <report>aspectj-report</report>
                                        </reports>
                                </reportSet>
                        </reportSets>
                </plugin>
        </plugins>
</reporting>

Note that I needed to set net.sourceforge.cobertura.datafile property in the maven-surefire-plugin configuration, because the 2.1 cobertura-maven-plugin has a bug that leads to the results file of the cobertura run being not read during report creation (which leads to 100% coverage and other strange results).

HTH

Sven

tarry wrote:
I've tried this (using 2.1 with 1.7) but the test results still incorrectly
show 100% for all classes


Steve Shucker wrote:
I just had the same problem. I've got my standard reporting suite declared in a parent pom for several projects. The plugin is supposed to check the package type and disable itself for non jar/war projects, but that's broken in 2.0. It's fixed in 2.1, but that's using a broken version of Cobertura 1.8.

My solution was to crack open the pom file for plugin version 2.1 and change the versions for cobertura and cobertura-runtime from 1.8->1.7. Works great. It even puts the cobertura.ser file in the right place now. I was banging my head against a wall for a bit when I deployed it to my local repo because running mvn cobertura:cobertura wouldn't find it, but that's just because I hadn't written some other config file. It works when I run the site goal.

-Steve


David Roussel wrote:
I reverted back to cobertura-maven-plugin v2.0 to fix the "all classes
are
100%" problem, and it worked fine on individual modules.

But the site build fails at the top pom project with http://jira.codehaus.org/browse/MCOBERTURA-38 MCOBERTURA-38 which is
fixed
in v2.1!!!

So I'm a bit stuck between the two bugs.   Is there a way to force the
2.0-plugin to use cobertura 1.7?  And would that fix it?

If the only solution is to use 2.1-SNAPSHOT... then I guess I'll have to
try
it.....

David



bkbonner wrote:
OK, I'll revert back to 2.0, thanks for the tip.


dan tran wrote:
use <version>2.0</version>

latest 2.1 is bad, and it should be taken out of repo1

-D


On 2/23/07, Arnaud Bailly <[EMAIL PROTECTED]> wrote:
Hello,
You may want to try the following configuration

<build>
<!-- indique les plugin qui seront utilisés dans le projet lors de la
compilation -->
<plugins>

  <!-- clean coverage data before collecting -->
  <plugin>
   <artifactId>cobertura-maven-plugin</artifactId>
   <groupId>org.codehaus.mojo</groupId>
   <executions>
    <execution>
     <goals>
      <goal>clean</goal>
     </goals>
    </execution>
   </executions>
  </plugin>

   </plugins>
</build>

<reporting>
<plugins>

  <!-- test coverage -->
  <plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>cobertura-maven-plugin</artifactId>
  </plugin>

</plugins>
</reporting>

HTH
--
OQube < software engineering \ génie logiciel >
Arnaud Bailly, Dr.
\web> http://www.oqube.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to