jacoco/jacoco — pull request #40 by Godin (2012-11-11 11:08:01+00:00)
Title: Doubled javaagent in argLine

1. I'm using plugin 0.6.0
2. I've jacoco-maven-plugin doubled because I want to measure unit tests result (in test phase with surefire) but also integration tests (in integration-test phase with failsafe)
3. Before test phase everything is OK:
```argLine set to -javaagent:/home/devel/tools/maven/repo/org/jacoco/org.jacoco.agent/0.6.0.201210061924/org.jacoco.agent-0.6.0.201210061924-runtime.jar=destfile=/home/devel/projects/micro/webapp/target/jacoco-unit.exec```
4. Before integration-test phase there is problem with correct argLine, because of the prepending it looks that:
```argLine set to -javaagent:/home/devel/tools/maven/repo/org/jacoco/org.jacoco.agent/0.6.0.201210061924/org.jacoco.agent-0.6.0.201210061924-runtime.jar=destfile=/home/devel/projects/micro/webapp/../target/jacoco-it.exec -javaagent:/home/devel/tools/maven/repo/org/jacoco/org.jacoco.agent/0.6.0.201210061924/org.jacoco.agent-0.6.0.201210061924-runtime.jar=destfile=/home/devel/projects/micro/webapp/target/jacoco-unit.exec```
As you can see there are two javaagents what results in:
```java.lang.instrument.IllegalClassFormatException: Error while instrumenting class org/apache/maven/surefire/booter/ForkedBooter.
Caused by: java.lang.IllegalStateException: Class org/apache/maven/surefire/booter/ForkedBooter is already instrumented.```
When we remove second javaagent (by defining it in the argLine property in the failsafe-plugin configuration it works great.

Example pom's:
```

org.apache.maven.plugins
maven-surefire-plugin
2.12.4

gui,arquillian

org.jacoco
jacoco-maven-plugin
${jacoco.version}

jacoco-initialize

prepare-agent

${project.basedir}/target/jacoco-unit.exec

arquillian

org.jacoco
jacoco-maven-plugin
${jacoco.version}

pre-integration-test

prepare-agent

pre-integration-test

${project.basedir}/../target/jacoco-it.exec

org.apache.maven.plugins
maven-failsafe-plugin
2.12.4

gui,arquillian

**/*.java

integration-test

integration-test
verify

```