ivaynberg / salve

Automatically exported from code.google.com/p/salve
0 stars 0 forks source link

Maven 3 configuration #30

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
So far I was using Maven 2 for instrumentation, with the configuration from 
http://code.google.com/p/salve/wiki/ConfiguringInstrumentation, that is:

      <executions>
        <execution>
          <goals>
            <!-- instrument production classes in target/classes -->
            <goal>instrument</goal>
            <!-- instrument test classes in target/test-classes -->
            <goal>instrument-test</goal>
          </goals>
        </execution>
      </executions>

When I updated to Maven 3, this did not work anymore: The classes packaged into 
my WAR did not contain instrumented code. After looking a bit closer, I 
observed that the classes in target/ DID get instrumented but were afterwards 
overwritten again with uninstrumented .class files.

What worked for me is to use the configuration

      <executions>
        <execution>
          <phase>process-classes</phase>
          <goals>
          <goal>instrument</goal>
          </goals>
        </execution>
      </executions>

that the Wiki gives for "legacy versions before 1.1".

I have to admit that I do not understand the Maven build process at this level 
of detail so I am not sure what the correct configuration should be. Maybe 
somebody with a deeper Maven knowledge can clarify?

Best,
Kaspar

Original issue reported on code.google.com by kaspar.f...@gmail.com on 3 Jan 2012 at 10:03

GoogleCodeExporter commented 9 years ago
The configuration I reported above instruments only the main (i.e., non-test) 
classes. The configuration should be:

<executions>
                    <execution>
                        <id>salve-instrument-classes</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>instrument</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>salve-instrument-test-classes</id>
                        <phase>process-test-classes</phase>
                        <goals>
                            <goal>instrument-test</goal>
                        </goals>
                    </execution>
                </executions>

Original comment by kaspar.f...@dreizak.com on 27 Feb 2012 at 2:48