[
http://jira.codehaus.org/browse/MCOBERTURA-41?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=208126#action_208126
]
Frederic Tardif commented on MCOBERTURA-41:
-------------------------------------------
I am using aspectj-maven-plugin 1.2 with cobertura-maven-plugin 2.3 and I still
have an issue.
Since I inject aspects in my src/main/java based on my src/test/aspects for my
unittest with weaveMainSourceFolder=true
{code}
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<weaveMainSourceFolder>true</weaveMainSourceFolder>
<XnoInline>true</XnoInline>
<Xreweavable>true</Xreweavable>
</configuration>
</execution>
</executions>
</plugin>
{code}
The instrumentation sequence seems to be impossible:
1- Cobertura instruments src/main/java in target/generated-classes/cobertura
2- Cobertura runs test-compile which runs aspectj which consequently instrument
in parallel my src/main/java in target/test-compile with the aspects defined in
src/test/aspects (since I have set weaveMainSourceFolder=true)
3- Cobertura then runs surefire with a classpath including both
target/test-compile and target/generated-classes/cobertura (which it believes
to be the cobertura's instrumented compilation of my src/main/java).
4- Then, probably because of the classpath order, my tests are run with the
instrumented version of target/test-compile (with my own aspects that I had
defined in my src/test/aspects). The classes are then not the one intrumented
my cobertura, causing to show a 0% coverage.
The trouble is obviously that classes are instrumented twice from src/main/java
instead of being re-instrumented one over the other.
I tried a workaround by doing something like: mvn test-compile
cobertura:cobertura by specifying to the cobertura plugin to take
target/test-compile as a basedir, but I figured out that cobertura seems to
re-run test-compile goal after its own intrumentation...
I am afraid it is a design issue of the cobertura plugin.
Any idea to fix this?
> Corbetura doesn't play well with AspectJ
> ----------------------------------------
>
> Key: MCOBERTURA-41
> URL: http://jira.codehaus.org/browse/MCOBERTURA-41
> Project: Maven 2.x Cobertura Plugin
> Issue Type: Bug
> Reporter: Howard M. Lewis Ship
> Attachments: pom.xml
>
>
> I'm using AspectJ on my project (Tapestry 5) and want to generate a cobeturer
> (what an awkward name!) report.
> The report generates warnings; further the final output shows 0% coverage on
> all code.
> [INFO] Generate "Cobertura Test Coverage" report.
> [INFO] Cobertura 1.7 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
> Cobertura: Loaded information on 164 classes.
> [cobertura] INFO [main]
> net.sourceforge.cobertura.reporting.ComplexityCalculator - Cannot find source
> file during CCN c
> omputation,
> source=[org/apache/tapestry/internal/aspects/AbstractClassTargetting.java]
> [cobertura] INFO [main]
> net.sourceforge.cobertura.reporting.ComplexityCalculator - Cannot find source
> file during CCN c
> omputation,
> source=[org/apache/tapestry/internal/aspects/CatchNullParameters.java]
> [cobertura] INFO [main]
> net.sourceforge.cobertura.reporting.ComplexityCalculator - Cannot find source
> file during CCN c
> omputation,
> source=[org/apache/tapestry/internal/aspects/InternalCatchNullParameters.java]
> [cobertura] INFO [main]
> net.sourceforge.cobertura.reporting.ComplexityCalculator - Cannot find source
> file during CCN c
> omputation,
> source=[org/apache/tapestry/internal/aspects/InternalOneShotChecks.java]
> [cobertura] INFO [main]
> net.sourceforge.cobertura.reporting.ComplexityCalculator - Cannot find source
> file during CCN c
> omputation,
> source=[org/apache/tapestry/internal/aspects/InternalSynchronization.java]
> [cobertura] INFO [main]
> net.sourceforge.cobertura.reporting.ComplexityCalculator - Cannot find source
> file during CCN c
> omputation,
> source=[org/apache/tapestry/internal/aspects/InternalUtilityChecks.java]
> [cobertura] INFO [main]
> net.sourceforge.cobertura.reporting.ComplexityCalculator - Cannot find source
> file during CCN c
> omputation, source=[org/apache/tapestry/internal/aspects/OneShotChecks.java]
> [cobertura] INFO [main]
> net.sourceforge.cobertura.reporting.ComplexityCalculator - Cannot find source
> file during CCN c
> omputation, source=[org/apache/tapestry/internal/aspects/Synchronization.java]
> [cobertura] INFO [main]
> net.sourceforge.cobertura.reporting.ComplexityCalculator - Cannot find source
> file during CCN c
> omputation, source=[org/apache/tapestry/internal/aspects/UtilityChecks.java]
> [cobertura] INFO [main] net.sourceforge.cobertura.reporting.html.HTMLReport
> - Could not generate HTML file for source f
> ile org/apache/tapestry/internal/aspects/InternalCatchNullParameters.java:
> Cannot find source file, name=[org/apache/tap
> estry/internal/aspects/InternalCatchNullParameters.java]
> [cobertura] INFO [main] net.sourceforge.cobertura.reporting.html.HTMLReport
> - Could not generate HTML file for source f
> ile org/apache/tapestry/internal/aspects/InternalSynchronization.java: Cannot
> find source file, name=[org/apache/tapestr
> y/internal/aspects/InternalSynchronization.java]
> [cobertura] INFO [main] net.sourceforge.cobertura.reporting.html.HTMLReport
> - Could not generate HTML file for source f
> ile org/apache/tapestry/internal/aspects/AbstractClassTargetting.java: Cannot
> find source file, name=[org/apache/tapestr
> y/internal/aspects/AbstractClassTargetting.java]
> [cobertura] INFO [main] net.sourceforge.cobertura.reporting.html.HTMLReport
> - Could not generate HTML file for source f
> ile org/apache/tapestry/internal/aspects/InternalUtilityChecks.java: Cannot
> find source file, name=[org/apache/tapestry/
> internal/aspects/InternalUtilityChecks.java]
> [cobertura] INFO [main] net.sourceforge.cobertura.reporting.html.HTMLReport
> - Could not generate HTML file for source f
> ile org/apache/tapestry/internal/aspects/UtilityChecks.java: Cannot find
> source file, name=[org/apache/tapestry/internal
> /aspects/UtilityChecks.java]
> [cobertura] INFO [main] net.sourceforge.cobertura.reporting.html.HTMLReport
> - Could not generate HTML file for source f
> ile org/apache/tapestry/internal/aspects/CatchNullParameters.java: Cannot
> find source file, name=[org/apache/tapestry/in
> ternal/aspects/CatchNullParameters.java]
> [cobertura] INFO [main] net.sourceforge.cobertura.reporting.html.HTMLReport
> - Could not generate HTML file for source f
> ile org/apache/tapestry/internal/aspects/InternalOneShotChecks.java: Cannot
> find source file, name=[org/apache/tapestry/
> internal/aspects/InternalOneShotChecks.java]
> [cobertura] INFO [main] net.sourceforge.cobertura.reporting.html.HTMLReport
> - Could not generate HTML file for source f
> ile org/apache/tapestry/internal/aspects/OneShotChecks.java: Cannot find
> source file, name=[org/apache/tapestry/internal
> /aspects/OneShotChecks.java]
> [cobertura] INFO [main] net.sourceforge.cobertura.reporting.html.HTMLReport
> - Could not generate HTML file for source f
> ile org/apache/tapestry/internal/aspects/Synchronization.java: Cannot find
> source file, name=[org/apache/tapestry/intern
> al/aspects/Synchronization.java]
> Report time: 1640ms
> [INFO] Cobertura Report generation was successful.
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESSFUL
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 39 seconds
> [INFO] Finished at: Wed Jul 26 19:50:19 PDT 2006
> [INFO] Final Memory: 38M/63M
> [INFO]
> ------------------------------------------------------------------------
> bash-3.1$
> bash-3.1$ mvn help
> [INFO] Scanning for projects...
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Invalid task 'help': you must specify a valid lifecycle phase, or a
> goal in the format plugin:goal or pluginGroup
> Id:pluginArtifactId:pluginVersion:goal
> [INFO]
> ------------------------------------------------------------------------
> [INFO] For more information, run Maven with the -e switch
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: < 1 second
> [INFO] Finished at: Wed Jul 26 19:52:36 PDT 2006
> [INFO] Final Memory: 1M/2M
> [INFO]
> ------------------------------------------------------------------------
> bash-3.1$ mvn help:help
> [INFO] Scanning for projects...
> [INFO] Searching repository for plugin with prefix: 'help'.
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Required goal not found: help:help
> [INFO]
> ------------------------------------------------------------------------
> [INFO] For more information, run Maven with the -e switch
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: < 1 second
> [INFO] Finished at: Wed Jul 26 19:52:42 PDT 2006
> [INFO] Final Memory: 2M/5M
> [INFO]
> ------------------------------------------------------------------------
> bash-3.1$
> I've attached my project's pom.xml.
> Sorry I missed the BOF tonight at OSCON!
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email