The following solved my problem of getting zero test coverage (using v2.0 of
cobertura-maven-plugin).

Added to the <strong>build</strong> section of pom:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.0</version>
                <executions>
                    <execution>
                        <phase>test</phase>
                        <goals>
                            <goal>cobertura</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

I had to add the plugin a second time in the build element to get it to
clean up cobertura.ser:

            <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>

I found this solution just by trial and error.

-Richard


Richard Brewster wrote:
> 
> Thanks, but I get ZERO test coverage, using either 2.0 or 2.1 of the
> cobertura-maven-plugin.  So something else is wrong.
> 
> I did verify that cobertura-maven-plugin 2.1 is depending on cobertura
> 1.8.  But cobertura 1.9 has been out since June, 2007.  Time to update the
> plugin.
> 
> Richard
> 
> 
> mraible wrote:
>> 
>> The Corbertura plugin for Maven has been notoriously buggy. Make sure
>> you have <version>2.0</version> specified for it to work properly.
>> 
>> With some googling, I found this - maybe it will help:
>> 
>> http://tinyurl.com/2n2mrz
>> 
>> Matt
>> 
>> On 9/21/07, Richard Brewster <[EMAIL PROTECTED]> wrote:
>>>
>>> Using AppFuse 2.0-RC1 modular struts 2 archetype.  But this problem
>>> occurs in
>>> previous archetypes too, for me.  In the core module the command:
>>>
>>> mvn clean site
>>>
>>> succeeds and the following is logged:
>>>
>>> Tests run: 45, Failures: 0, Errors: 0, Skipped: 0
>>>
>>> [INFO] Preparing surefire-report:report-only
>>> [INFO] No goals needed for project - skipping
>>> [INFO] Preparing cobertura:cobertura
>>> [INFO] [aspectj:compile {execution: default}]
>>> [INFO] [resources:resources]
>>> [INFO] Using default encoding to copy filtered resources.
>>> [INFO] [compiler:compile]
>>> [INFO] Nothing to compile - all classes are up to date
>>> [INFO] [cobertura:instrument]
>>> [INFO] Cobertura 1.7 - GNU GPL License (NO WARRANTY) - See COPYRIGHT
>>> file
>>> Instrumenting 40 classes to
>>> C:\dev\af-modular\core\target\generated-classes\cobertura
>>> Cobertura: Saved information on 38 classes.
>>> Instrument time: 203ms
>>>
>>> [INFO] Instrumentation was successful.
>>>
>>> ... all tests run again, successfully again.  Finally you see:
>>>
>>> [INFO] Cobertura 1.7 - GNU GPL License (NO WARRANTY) - See COPYRIGHT
>>> file
>>> Cobertura: Loaded information on 38 classes.
>>> Report time: 719ms
>>>
>>> [INFO] Cobertura Report generation was successful.
>>>
>>> When you look at the report, it is all RED.  Zero coverage.  It seems to
>>> me
>>> that the generated classes are not put into the test classpath ahead of
>>> the
>>> normal classes, as required.  You would expect Cobertura to log that it
>>> has
>>> loaded information on the classes under test, too, and I see no logs of
>>> that
>>> kind.  Must be a classpath problem.  What should I do?
>>>
>>> Thanks,
>>>
>>> Richard Brewster
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Cobertura-reporting-0--coverage-tf4496724s2369.html#a12823394
>>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>> 
>> 
>> -- 
>> http://raibledesigns.com
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Cobertura-reporting-0--coverage-tf4496724s2369.html#a12906490
Sent from the AppFuse - User mailing list archive at Nabble.com.

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

Reply via email to