Lee,

I was able to move past this issue by removing the version tag from my
Cobertura plugin specifications (below) and performing a -U when
executing "mvn clean site".  

 

I have since found a conflict between the Cobertura and AspectJ plugins
where, because of a bug with AspectJ, the plugin copies the .class files
from /src/main/java into my /target/test-classes directory.  The
surefire plugin puts the /target/test-classes directory in front of the
/target/generated-classes/cobertura directory in the classpath for the
tests.  Therefore, non-instrumented class files were being loaded before
the cobertura classes.  Therefore, I always got 0 % results on the
projects which used Aspectj.  I got around this by modifying the
surefire plugin to load the "classesdir" before the "testclassesdir"
and deployed that change locally.  Of course, this is not ideal because
now mock objects are useless in my test directory.  However, until the
bug with the AspectJ compiler gets fixed (and thus the AspectJ plugin),
it's the best I could do.

 

Now, if someone would just make Cobertura exercise the
"integration-test" goal instead of "test" so my web application project
which builds and tests a war during the integration-test phase can get
some coverage reports.  :-)  That's my current pain...

 

Hope this helps,

D DeFrance

 

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Lee Meador
Sent: Tuesday, April 04, 2006 1:57 PM
To: Maven Users List; Daun DeFrance
Subject: Re: Continued Cobertura Plugin Issues

 

Did you get this worked out?

On 3/28/06, Daun DeFrance <[EMAIL PROTECTED]> wrote: 

FWIW,
Removing the cobertura:clean execution below from my pom means I get
results every time I run site now, but they are cumulative.  So if a 
line gets called twice during a test, every time I run "site", the line
count increments by 2.  And if I remove a test for that line, it still
shows the last line count before the test removal.  So, for me, this is 
unacceptable.  I need cobertura to tell me the coverage of THIS run, not
whatever is left in the ser file from previous runs.

It seems like this is the old problem of using process boundaries to set
the ser file and because the test is running in the same process as the 
reporting, I get 0% coverage.

Also, removing the <scope>test</scope> from the cobertura jar keeps the
test from running twice, but I get ClassDefNotFound errors if I remove
the jar as a dependency entirely. 

Surely, I am just really messed up here and there's a simple answer to
all these issues.

Thanks,
D DeFrance

-----Original Message-----
From: Daun DeFrance [mailto: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ]
Sent: Tuesday, March 28, 2006 12:46 PM
To: users@maven.apache.org
Subject: Continued Cobertura Plugin Issues

Hi all,

I followed Boris Lenzinger's suggestions dated March 19 (Re: [M2] Maven 
Generated Reports).  I am unable to generate any coverage of my
projects.  Assuming it was something about my multiproject build
(because running "site" on the parent pom.xml still generates a
Cobertura error"), I decided to start from scratch. 



I created a simple archetype project using "mvn archetype:create
-DgroupId=com.mycompany.app -DartifactId=my-app".



I then modified the pom as follows:



<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>com.mycompany.app</groupId>

      <artifactId>my-app</artifactId>

      <packaging>jar</packaging> 

      <version>1.0-SNAPSHOT</version>

      <name>Maven Quick Start Archetype</name>

      <url>http://maven.apache.org</url> 

      <dependencies>

            <dependency>

                  <groupId>junit</groupId>

                  <artifactId>junit</artifactId>

                  <version> 3.8.1</version>

                  <scope>test</scope>

            </dependency>

            <dependency>

                  <groupId>cobertura</groupId> 

                  <artifactId>cobertura</artifactId>

                  <version>1.7</version>

                  <scope>test</scope>

            </dependency> 



      </dependencies>

      <pluginRepositories>

            <pluginRepository>

                  <id>CodeHaus</id>

                  <name></name> 

                  <url>http://snapshots.maven.codehaus.org/maven2</url>

                  <layout>default</layout>

                  <snapshots> 

                        <enabled>true</enabled>

                  </snapshots>

                  <releases>

                        <enabled>false</enabled> 

                        <updatePolicy>never</updatePolicy>

                  </releases>

            </pluginRepository>

      </pluginRepositories>



      <reporting>

            <plugins>



                  <plugin>

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

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

                        <version>2.0-20060322.071830-5</version>

                  </plugin>

            </plugins>

      </reporting>

      <build>

            <plugins>

                  <plugin>

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

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

                        <version>2.0-20060322.071830-5</version>

                        <executions>

                              <execution>

                                    <goals> 

                                          <goal>clean</goal>

                                    </goals>

                              </execution>

                        </executions> 

                  </plugin>



            </plugins>

      </build>



</project>



When I run "mvn clean site", I get coverage reports generated, but they 
say 0% coverage even though I have modified the AppTest to call the
App.main method.  If I run "mvn site" again, I get the correct coverage
reported.  I am obviously using maven 2.0.3.  What else am I missing? 
For those of you who are successful with Cobertura, what goals are you
running and are you using a multiproject build?



Thanks in advance,

D DeFrance


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




-- 
-- Lee Meador
Sent from gmail. My real email address is [EMAIL PROTECTED] 

Reply via email to