You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Davis Ford <da...@zenoconsulting.biz> on 2006/05/15 18:02:49 UTC

Maven 2 Emma Plugin?

Hi, we used to use the maven-emma plugin and maven 1.* but have just
upgraded to maven 2.0.4.

If I put a dependency on emma like this:

<dependency>
			<groupId>emma</groupId>
			<artifactId>maven-emma-plugin</artifactId>
			<version>0.5</version>
		</dependency>

I get this:

Downloading: http://www.ibiblio.org/maven2//emma/maven-emma-plugin/0.5/maven-emma-plugin-0.5.pom
993b downloaded
[WARNING] POM for 'emma:maven-emma-plugin:pom:0.5:compile' is invalid.
It will be ignored for artifact resolution. Reason: Not a v4.0.0 POM.

I see that there is also an artifactId just called "emma" with a
couple versions.

1) What's the difference between emma and maven-emma-plugin?
2) Can I somehow get one or the other to work with maven 2.0.4?
3) If not, is there any other code coverage plugin people know of that
works with maven 2.0.4?

Thx in advance,
Davis

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


Re: Maven 2 Emma Plugin?

Posted by Jorg Heymans <jo...@gmail.com>.
We use emma as well and would be very interested in an m2 plugin for it.

I had some success by running emma through m2 as an ant-plugin, here is the
config :

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>emma-coverage-report</id>
            <phase>test-compile</phase>
            <configuration>
              <tasks>
                <taskdef resource="emma_ant.properties" classpathref="
maven.plugin.classpath" />
                <emma enabled="true">
                  <instr instrpathref="maven.test.classpath"
mode="overwrite"
                         metadatafile="target/emma/metadata.emma">
                    <filter includes="com.*"/>
                  </instr>
                </emma>
                              <junit fork="yes" forkmode="perBatch"
haltonfailure="no">
                                  <batchtest
todir="target/emma/junit-reports-ignore">
                                    <fileset
dir="target/emma/instrumented-classes">
                                      <include name="**/*Test*"/>
                                    </fileset>
                                  </batchtest>
                                <classpath>
                                  <pathelement path="maven.test.classpath"/>
                                  <pathelement path="maven.plugin.classpath
"/>
                                </classpath>
                              </junit>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
                <dependency>
                  <groupId>emma</groupId>
                  <artifactId>emma</artifactId>
                  <version>2.0.5312</version>
                </dependency>
                <dependency>
                  <groupId>emma</groupId>
                  <artifactId>emma_ant</artifactId>
                  <version>2.0.5312</version>
                </dependency>
        </dependencies>
      </plugin>

IIRC the instrumentation like this works fine, but I had problems getting
surefire to actually run the instrumented classes.

HTH
Jorg

Re: Maven 2 Emma Plugin?

Posted by Toni Price <to...@mail.com>.
Hi Davis

I'm a bit of a novice with Maven (so the information here might not be the
best way to do things) but I struggled with this same question before giving
up on Emma for the moment and using Cobertura instead.

(BTW I subsquently found this on the Emma site (at
http://emma.sourceforge.net/plugins):
"Maven v2.x is a substantial rewrite of v1.x requiring correspondingly
substantial plugin redesign/rework. There is some interest in creating a
proper Maven v2.x plugin for EMMA. Please get in touch if you would like to
contribute or if you are aware of an independent effort.")

Regarding your question (1), my understanding is that "emma" would be the
actual emma code, whereas "maven-emma-plugin" would be the plugin for maven
to run it. (If I'm wrong about this - anyone - please let me know ...)

In any event here is what I put in my pom.xml to use cobertura (works for me
on Maven 2.0.4):

<project>

  <build>
    [...]
    <plugins>
      [...]
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>clean</id>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    [...]
    <!-- asm, used by cobertura -->
    <dependency>
      <groupId>asm</groupId>
      <artifactId>asm</artifactId>
      <version>2.2.1</version>
      <scope>test</scope>
    </dependency>

    <!-- oro, used by cobertura -->
    <dependency>
      <groupId>oro</groupId>
      <artifactId>oro</artifactId>
      <version>2.0.8</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <reporting>
    [...]
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </reporting>

</project>

Then you should be able to run 'mvn cobertura:cobertura' or 'mvn site' and
the cobertura reports will be generated in target/site/cobertura/index.html.

The <executions> section is to bind cobertura to the clean goal since
otherwise the data file generated by cobertura (by default cobertura.ser)
does not get deleted when you run the clean goal (I gather this is a problem
caused by the fact that it's currently not possible to change the output
path of cobertura.ser).

Hope this helps,
Toni

--
View this message in context: http://www.nabble.com/Maven-2-Emma-Plugin--t1621781.html#a4394892
Sent from the Maven - Users forum at Nabble.com.


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