Thank you, but this does not really solve my problem. The problem is not that I cannot instrument dependency JARs. The problem is I cannot cleanly get instrumented JARs into the unit test classpath.

Vasiliy

COURCY Michael wrote:
Hi From my experience with emma I use a ant call after the compilation phase.
Ant is going much more power than the emma plugin

                  <!--
pour instrumenter l'appli web mvn install -P instrument --> <profile>
                        <id>instrument</id>
                        <build>
                                <plugins>
                                        <plugin>
                                    <artifactId>maven-antrun-plugin</artifactId>
                                      <executions>
                                         <execution>
                                           <phase>process-classes</phase>
<configuration> <tasks>
                                                        <ant 
antfile="${basedir}/instrument_for_coverage.xml">
                                                                                <target 
name="instrument"/>
                                                                        </ant>
</tasks> </configuration>
                                            <goals>
                                              <goal>run</goal>
                                            </goals>
                                          </execution>
                                        </executions>
                                  </plugin>
                                  </plugins>
                          </build>
                  </profile>

And use the overwrite mode in the ant, then only your class are going to be instrumended if you active this option :
<target name="instrument" depends="init">
<echo>Instrumenting the classes</echo>
        <emma enabled="${emma.enabled}" >
<instr instrpathref="ServeurJava.classpath" metadatafile="${metadatafile}"
             merge="true"
                         mode="overwrite"
> <filter value="${emma.filter}" />
      </instr>
    </emma>
        
  </target>

Thus running Mvn package -P instrument
produce an instrumented war

And Mvn package Produce a regular one
Good luck, emma rocks !!





-----Message d'origine-----
De : vasiliy.bara...@sun.com [mailto:vasiliy.bara...@sun.com] Envoyé : mercredi 18 mars 2009 15:32
À : users@maven.apache.org
Objet : how to EMMA-instrument dependencies

Hi,

I have a Maven 2 project that depends on a number of other Maven 2 projects that are built locally and installed into the local repository. I need to instrument some of the dependency JARs with the EMMA coverage tool and have Maven run unit tests against instrumented JARs rather than the original dependencies. The emma-maven-plugin
(http://mojo.codehaus.org/emma-maven-plugin) does not seem to be of much help 
as it does not seem to support this scenario.

Of course, it would be ideal if the emma-maven-plugin had support for this. In 
fact, the plugin has an 'instrumentationPaths' parameter which can be used to 
instrument classes from arbitrary directories; so I think dependencies can be 
copied, unpacked, instrumented this way and passed to maven-surefire-plugin via 
the 'classesDirectory' parameter; but in this case both the instrumented 
classes and original dependencies both appear on the test classpath, which 
sounds wrong.

Actually, I can bypass emma-maven-plugin and run EMMA instrumentor via 
exec-maven-plugin, but again, it looks like the only way to pass the 
instrumented classes to surefire is via the 'classesDirectory' or 
'additionalClasspathElements' parameter, which is the same problem as above, 
which makes me think this is not solely emma-maven-plugin's problem (hence 
posting to this list).

What would be the right Maven way to achieve the goal? I am new to Maven so I 
am sorry if I am missing something obvious. I spent several days trying to find 
a solution, to no success.

In fact, I have some control over the dependency projects so I think I can build them so that the resulting JARs will contain instrumented classes (or I can instrument JARs separately and 'install:install-file' them as separate components), but this is undesirable.

I hope I am making sense.

Thank you,
Vasiliy



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to