Hi,

I've been trying to get the emma-maven-plugin to do both the reporting when running the site goal, but also to fail the build when lineRate is under 60 %. I've been struggling with phases to bind the check goal to, but I get different errors.

In my pom.xml the reporting section looks like this (the same each time):
   <reporting>
       <plugins>
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-project-info-reports-plugin</artifactId>
           </plugin>
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-javadoc-plugin</artifactId>
               <configuration>
<sourcepath>${project.build.sourceDirectory};${project.build.directory}/cxf-source</sourcepath>
               </configuration>
           </plugin>
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-surefire-report-plugin</artifactId>
           </plugin>
           <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>emma-maven-plugin</artifactId>
           </plugin>
       </plugins>
   </reporting>

When binding to the test phase:

           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-surefire-plugin</artifactId>
               <configuration>
                   <forkMode>once</forkMode>
                   <reportFormat>xml</reportFormat>
<classesDirectory>${project.build.directory}/generated-classes/emma/classes</classesDirectory>
               </configuration>
           </plugin>
           <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>emma-maven-plugin</artifactId>
               <configuration>
                   <check>
                       <!-- current rates, we shouldn't drop below this -->
                       <classRate>100</classRate>
                       <methodRate>76</methodRate>
                       <blockRate>62</blockRate>
                       <lineRate>60</lineRate>
                       <haltOnFailure>true</haltOnFailure>
                   </check>
                   <filters>
                       <filter>+nl.tesis.ea.dao.impl.*</filter>
                   </filters>
               </configuration>
               <executions>
                   <execution>
                       <phase>test</phase>
                       <goals>
                           <!--<goal>clean</goal>-->
                           <goal>check</goal>
                       </goals>
                   </execution>
               </executions>
           </plugin>

I get an error:
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------ [INFO] class [nl.tesis.ea.dao.impl.PdfServiceDaoWsImpl$1] appears to be instrumented already [INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.IllegalStateException: class [nl.tesis.ea.dao.impl.PdfServiceDaoWsImpl$1] appears to be instrumented already
   at com.vladium.emma.instr.InstrVisitor.visit(InstrVisitor.java:172)
   at com.vladium.emma.instr.InstrVisitor.process(InstrVisitor.java:111)
at com.vladium.emma.instr.InstrProcessorST.handleFile(InstrProcessorST.java:471) at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:193) at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177) at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177) at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177) at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177) at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177) at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumerate(IPathEnumerator.java:97) at com.vladium.emma.instr.InstrProcessorST._run(InstrProcessorST.java:715)
   at com.vladium.emma.Processor.run(Processor.java:54)
at org.codehaus.mojo.emma.task.InstrumentTask.execute(InstrumentTask.java:111) at org.codehaus.mojo.emma.EmmaInstrumentMojo.doExecute(EmmaInstrumentMojo.java:155) at org.codehaus.mojo.emma.AbstractEmmaMojo.execute(AbstractEmmaMojo.java:98) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)

But when binding to process-sources, some test fail in error.

What is the correct way to do this?

BTW. There was a bug in the parsing of coverage.xml. Filed an issue in JIRA (with patch): http://jira.codehaus.org/browse/MOJO-1271

Regards,
Matthijs

--
Matthijs Wensveen
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to