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] 
Sent: Tuesday, March 28, 2006 12:46 PM
To: [email protected]
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]

Reply via email to