New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doubled javaagent in argLine #40

Closed
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
10 participants
@Godin
Member

Godin commented Nov 11, 2012

  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:

 <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12.4</version>
        <configuration>
          <excludedGroups>gui,arquillian</excludedGroups>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.version}</version>
        <executions>
          <execution>
            <id>jacoco-initialize</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <configuration>
              <destFile>${project.basedir}/target/jacoco-unit.exec</destFile>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>

  <profile>
      <id>arquillian</id>
       <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>${jacoco.version}</version>
            <executions>
              <execution>
                <id>pre-integration-test</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
                <phase>pre-integration-test</phase>
                <configuration>
                  <destFile>${project.basedir}/../target/jacoco-it.exec</destFile>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.12.4</version>
            <configuration>
              <groups>gui,arquillian</groups>         
              <includes>
                <include>**/*.java</include>
              </includes>
            </configuration>
            <executions>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
  </profile>

@ghost ghost assigned Godin Nov 9, 2012

@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Nov 11, 2012

Member

@jkubrynski Could you please verify my fix by building JaCoCo with my changes? Even if we have test for this issue, I'd like to be sure that problem fixed for you, before merge into the master.

Member

Godin commented Nov 11, 2012

@jkubrynski Could you please verify my fix by building JaCoCo with my changes? Even if we have test for this issue, I'd like to be sure that problem fixed for you, before merge into the master.

@jkubrynski

This comment has been minimized.

Show comment
Hide comment
@jkubrynski

jkubrynski Nov 11, 2012

@Godin It works "almost" great :) Without declaring argLine there is no doubled javaagent, and the output is produced ok. But when I add maven-failsafe-plugin argLine containing for example -Xmx1024m, the jacoco output looks normally (argLine set to -javaagent:...=destfile=...jacoco-it.exec) but after build there is no jacoco-it.exec file. Removing failsave-plugin->configuration->argLine resolves this problem.

jkubrynski commented Nov 11, 2012

@Godin It works "almost" great :) Without declaring argLine there is no doubled javaagent, and the output is produced ok. But when I add maven-failsafe-plugin argLine containing for example -Xmx1024m, the jacoco output looks normally (argLine set to -javaagent:...=destfile=...jacoco-it.exec) but after build there is no jacoco-it.exec file. Removing failsave-plugin->configuration->argLine resolves this problem.

@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Nov 11, 2012

Member

@jkubrynski I'm pretty sure that problem with maven-failsafe-plugin not connected with this one and was there before. Let's say this is a known limitation. To workaround configure maven-failsafe-plugin via property "argLine", but not via parameter in configuration. Or configure jacoco-maven-plugin to set property different than "argLine" by using parameter "propertyName" and then use it in configuration for maven-failsafe-plugin:

<plugin>
  <groupId>org.jacoco</groupId>
  <artifactId>jacoco-maven-plugin</artifactId>
  <configuration>
    <propertyName>coverageAgent</propertyName>
  </configuration>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-failsafe-plugin</artifactId>
  <configuration>
    <argLine>${coverageAgent} -Xmx1024m</argLine>
  </configuration>
</plugin>
Member

Godin commented Nov 11, 2012

@jkubrynski I'm pretty sure that problem with maven-failsafe-plugin not connected with this one and was there before. Let's say this is a known limitation. To workaround configure maven-failsafe-plugin via property "argLine", but not via parameter in configuration. Or configure jacoco-maven-plugin to set property different than "argLine" by using parameter "propertyName" and then use it in configuration for maven-failsafe-plugin:

<plugin>
  <groupId>org.jacoco</groupId>
  <artifactId>jacoco-maven-plugin</artifactId>
  <configuration>
    <propertyName>coverageAgent</propertyName>
  </configuration>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-failsafe-plugin</artifactId>
  <configuration>
    <argLine>${coverageAgent} -Xmx1024m</argLine>
  </configuration>
</plugin>
@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Nov 11, 2012

Member

@marchof Could you please also take a look on this issue and proposed solution?

Previous behaviour is to always prepend agent, which is documented in AgentMojo. And proposed solution is to replace, if agent already there.

I'm asking, because due to limitation mentioned in my previous comment, I'm not sure that we should fix this - maybe instead we should just document those behaviours, because solution described in my previous comment covers they both.

Member

Godin commented Nov 11, 2012

@marchof Could you please also take a look on this issue and proposed solution?

Previous behaviour is to always prepend agent, which is documented in AgentMojo. And proposed solution is to replace, if agent already there.

I'm asking, because due to limitation mentioned in my previous comment, I'm not sure that we should fix this - maybe instead we should just document those behaviours, because solution described in my previous comment covers they both.

@jkubrynski

This comment has been minimized.

Show comment
Hide comment
@jkubrynski

jkubrynski Nov 11, 2012

@Godin I've checked your solution and it really fix both issues - I've tested setting propertyName with version 0.6.0 and it works. But in my opinion you should push your fix, because without using argLine it simplifies using Jacoco for measuring unit + it coverage. Let me know and I'll close this issue.

jkubrynski commented Nov 11, 2012

@Godin I've checked your solution and it really fix both issues - I've tested setting propertyName with version 0.6.0 and it works. But in my opinion you should push your fix, because without using argLine it simplifies using Jacoco for measuring unit + it coverage. Let me know and I'll close this issue.

@marchof

This comment has been minimized.

Show comment
Hide comment
@marchof

marchof Nov 11, 2012

Member

If we redefine the JaCoCo agent definition only I'm perfectly o.k. with the fixt.

Actually it took me some time to wrap my mind about the implementation:

  • Are you sure the code works when the are white spaces in the agent parameter?
  • Can we provide some inline comments or more smaller methods to make it more obvious what's going on here why?
Member

marchof commented Nov 11, 2012

If we redefine the JaCoCo agent definition only I'm perfectly o.k. with the fixt.

Actually it took me some time to wrap my mind about the implementation:

  • Are you sure the code works when the are white spaces in the agent parameter?
  • Can we provide some inline comments or more smaller methods to make it more obvious what's going on here why?
@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Nov 12, 2012

Member

@marchof You are right on both points. And indeed - it will not work in some cases with white spaces, so I should completely rework solution.

Member

Godin commented Nov 12, 2012

@marchof You are right on both points. And indeed - it will not work in some cases with white spaces, so I should completely rework solution.

@Zlika

This comment has been minimized.

Show comment
Hide comment
@Zlika

Zlika Jan 14, 2013

Will this bug be fixed in the next release ? It is really annoying, and I'm not able to find a viable workaround: either I have a double javaagent, or (if I try the workaround proposed by Godin) I only have code coverage in integration tests, but nothing in unit tests!

Zlika commented Jan 14, 2013

Will this bug be fixed in the next release ? It is really annoying, and I'm not able to find a viable workaround: either I have a double javaagent, or (if I try the workaround proposed by Godin) I only have code coverage in integration tests, but nothing in unit tests!

@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Jan 15, 2013

Member

@Zlika I'm not sure that we will push this into upcoming version - the code here must be fully reworked before going into master. Moreover - I'm not sure that fix of this ticket will help you, if now you're not able to use provided workaround. So could you please share your configuration or minimalistic example of project to reproduce your problem? This can be done for example by creation of project/repository in GitHub or by sending an email to JaCoCo Users Mailing List. Thanks for your understanding.

Member

Godin commented Jan 15, 2013

@Zlika I'm not sure that we will push this into upcoming version - the code here must be fully reworked before going into master. Moreover - I'm not sure that fix of this ticket will help you, if now you're not able to use provided workaround. So could you please share your configuration or minimalistic example of project to reproduce your problem? This can be done for example by creation of project/repository in GitHub or by sending an email to JaCoCo Users Mailing List. Thanks for your understanding.

@Zlika

This comment has been minimized.

Show comment
Hide comment
@Zlika

Zlika Jan 16, 2013

@Godin The workaround is ok if I do "mvn clean install" and then "mvn site", but the problem is still present if I do "mvn clean install site".

Zlika commented Jan 16, 2013

@Godin The workaround is ok if I do "mvn clean install" and then "mvn site", but the problem is still present if I do "mvn clean install site".

@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Jan 16, 2013

Member

@Zlika As I said before - it would be better if you'll help us to reproduce your issue by providing example project.

Member

Godin commented Jan 16, 2013

@Zlika As I said before - it would be better if you'll help us to reproduce your issue by providing example project.

@Zlika

This comment has been minimized.

Show comment
Hide comment

Zlika commented Jan 16, 2013

@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Jan 16, 2013

Member

@Zlika Thanks! I'll take a look as soon as will have free time.

Member

Godin commented Jan 16, 2013

@Zlika Thanks! I'll take a look as soon as will have free time.

@mfriedenhagen

This comment has been minimized.

Show comment
Hide comment
@mfriedenhagen

mfriedenhagen Jan 18, 2013

Member

Hello,

I have another sample project https://github.com/mfriedenhagen/jacoco-test, mvn clean verify site will add the argline twice in https://github.com/mfriedenhagen/jacoco-test/tree/jacoco-prepare-agent-called-twice, because the maven-surefire-report-plugin will execute the report goal by default which forks a lifecycle of it's own. A workaround is to define a reportset for this (https://github.com/mfriedenhagen/jacoco-test/blob/39939514cb2d8ac57bdd96500275ea31da875331/pom.xml#L78)

Member

mfriedenhagen commented Jan 18, 2013

Hello,

I have another sample project https://github.com/mfriedenhagen/jacoco-test, mvn clean verify site will add the argline twice in https://github.com/mfriedenhagen/jacoco-test/tree/jacoco-prepare-agent-called-twice, because the maven-surefire-report-plugin will execute the report goal by default which forks a lifecycle of it's own. A workaround is to define a reportset for this (https://github.com/mfriedenhagen/jacoco-test/blob/39939514cb2d8ac57bdd96500275ea31da875331/pom.xml#L78)

@Zlika

This comment has been minimized.

Show comment
Hide comment
@Zlika

Zlika Jan 21, 2013

@mfriedenhagen Thank you for your workaround. I see however one small problem remaining : the failsafe report web pages are not generated anymore (although the failsafe-reports folder exists and the failsafe-summary.xml file is present). In the Maven output I can see:

>>> maven-surefire-report-plugin:2.13:report-only (report:report-only) @ webapp >>>
<<< maven-surefire-report-plugin:2.13:report-only (report:report-only) @ webapp <<<
>>> maven-surefire-report-plugin:2.13:failsafe-report-only (report:failsafe-report-only) @ webapp >>>
<<< maven-surefire-report-plugin:2.13:failsafe-report-only (report:failsafe-report-only) @ webapp <<<

but no web page is generated for the integration tests.

Zlika commented Jan 21, 2013

@mfriedenhagen Thank you for your workaround. I see however one small problem remaining : the failsafe report web pages are not generated anymore (although the failsafe-reports folder exists and the failsafe-summary.xml file is present). In the Maven output I can see:

>>> maven-surefire-report-plugin:2.13:report-only (report:report-only) @ webapp >>>
<<< maven-surefire-report-plugin:2.13:report-only (report:report-only) @ webapp <<<
>>> maven-surefire-report-plugin:2.13:failsafe-report-only (report:failsafe-report-only) @ webapp >>>
<<< maven-surefire-report-plugin:2.13:failsafe-report-only (report:failsafe-report-only) @ webapp <<<

but no web page is generated for the integration tests.

@mfriedenhagen

This comment has been minimized.

Show comment
Hide comment
@mfriedenhagen

mfriedenhagen Jan 21, 2013

Member

@Zlika : Did you try this with my sample project? When I run mvn clean verify site the failsafe report is rendered.

Member

mfriedenhagen commented Jan 21, 2013

@Zlika : Did you try this with my sample project? When I run mvn clean verify site the failsafe report is rendered.

@FibreFoX

This comment has been minimized.

Show comment
Hide comment
@FibreFoX

FibreFoX Feb 28, 2013

Maybe it doesn't help at all, but i am having no problem with the version 0.6.2, i get the reports with both: surefire AND failsafe
https://github.com/FibreFoX/cdi-sessionscoped-login/blob/master/pom.xml

i am setting destFile to an empty string, maybe that does the trick, also i do not have maven profiles, but my tests run ok, and both .exec-files are generated.

FibreFoX commented Feb 28, 2013

Maybe it doesn't help at all, but i am having no problem with the version 0.6.2, i get the reports with both: surefire AND failsafe
https://github.com/FibreFoX/cdi-sessionscoped-login/blob/master/pom.xml

i am setting destFile to an empty string, maybe that does the trick, also i do not have maven profiles, but my tests run ok, and both .exec-files are generated.

@findgopi

This comment has been minimized.

Show comment
Hide comment
@findgopi

findgopi May 22, 2013

Can you please check my comment #32 (comment),
in short without agent added in argline of surefire-plugin I couldn't get JaCoCo execution file, but if I add the agent in argLine of surefire-plugin I get the execution file, but the logs are messed up with instrumentation errors.

findgopi commented May 22, 2013

Can you please check my comment #32 (comment),
in short without agent added in argline of surefire-plugin I couldn't get JaCoCo execution file, but if I add the agent in argLine of surefire-plugin I get the execution file, but the logs are messed up with instrumentation errors.

@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin May 24, 2013

Member

@findgopi First of all - preferable to use Users Mailing List to get help ( https://groups.google.com/d/forum/jacoco ), instead of issue tracker, which should be used to discuss how to fix confirmed bugs and implement new features.

Second - see my comment #32 (comment)

Thanks for your understanding.

Member

Godin commented May 24, 2013

@findgopi First of all - preferable to use Users Mailing List to get help ( https://groups.google.com/d/forum/jacoco ), instead of issue tracker, which should be used to discuss how to fix confirmed bugs and implement new features.

Second - see my comment #32 (comment)

Thanks for your understanding.

@melloware

This comment has been minimized.

Show comment
Hide comment
@melloware

melloware Aug 17, 2013

Has this been fixed? I am using 0.6.3 and have a attached a simple test maven project that exhibits the behavior. It works fine with "mvn clean package" but fails as soon as you add a second goal "mvn clean package install".

Just run...

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Then change the pom.xml to match mine below and you will see it fail on "mvn clean package install"

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany.app</groupId>
    <artifactId>my-app</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>my-app</name>
    <url>http://maven.apache.org</url>
    <properties>
        <jdk.version>1.6</jdk.version>
        <jodatime.version>2.2</jodatime.version>
        <jacoco.version>0.6.3.201306030806</jacoco.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>         
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                    <compilerVersion>${jdk.version}</compilerVersion>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <groupId>org.apache.maven.plugins</groupId>
                <version>2.15</version>
                <configuration>
                    <skipTests>false</skipTests>
                    <forkCount>3</forkCount>
                    <reuseForks>false</reuseForks>
                    <parallel>classes</parallel>
                    <threadCount>5</threadCount>
                    <useSystemClassLoader>true</useSystemClassLoader>
                    <testFailureIgnore>false</testFailureIgnore>
                    <failIfNoTests>true</failIfNoTests>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <reportPlugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-project-info-reports-plugin</artifactId>
                            <version>2.7</version>
                            <configuration>
                                <dependencyDetailsEnabled>true</dependencyDetailsEnabled>
                                <dependencyLocationsEnabled>true</dependencyLocationsEnabled>
                            </configuration>
                            <!-- simpler configuration without reportSets available for usual cases -->
                            <reports>
                                <report>summary</report>
                                <report>dependencies</report>
                                <report>scm</report>
                                <report>cim</report>
                                <report>project-team</report>
                                <report>distribution-management</report>
                                <report>plugins</report>
                            </reports>
                        </plugin>
                        <plugin>
                            <artifactId>maven-surefire-report-plugin</artifactId>
                            <version>2.15</version>
                            <configuration>
                                <inherited>true</inherited> 
                                <aggregate>false</aggregate>
                            </configuration>
                        </plugin>
                        <plugin>
                            <groupId>org.jacoco</groupId>
                            <artifactId>jacoco-maven-plugin</artifactId>
                        </plugin>
                    </reportPlugins>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

melloware commented Aug 17, 2013

Has this been fixed? I am using 0.6.3 and have a attached a simple test maven project that exhibits the behavior. It works fine with "mvn clean package" but fails as soon as you add a second goal "mvn clean package install".

Just run...

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Then change the pom.xml to match mine below and you will see it fail on "mvn clean package install"

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany.app</groupId>
    <artifactId>my-app</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>my-app</name>
    <url>http://maven.apache.org</url>
    <properties>
        <jdk.version>1.6</jdk.version>
        <jodatime.version>2.2</jodatime.version>
        <jacoco.version>0.6.3.201306030806</jacoco.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>         
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                    <compilerVersion>${jdk.version}</compilerVersion>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <groupId>org.apache.maven.plugins</groupId>
                <version>2.15</version>
                <configuration>
                    <skipTests>false</skipTests>
                    <forkCount>3</forkCount>
                    <reuseForks>false</reuseForks>
                    <parallel>classes</parallel>
                    <threadCount>5</threadCount>
                    <useSystemClassLoader>true</useSystemClassLoader>
                    <testFailureIgnore>false</testFailureIgnore>
                    <failIfNoTests>true</failIfNoTests>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <reportPlugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-project-info-reports-plugin</artifactId>
                            <version>2.7</version>
                            <configuration>
                                <dependencyDetailsEnabled>true</dependencyDetailsEnabled>
                                <dependencyLocationsEnabled>true</dependencyLocationsEnabled>
                            </configuration>
                            <!-- simpler configuration without reportSets available for usual cases -->
                            <reports>
                                <report>summary</report>
                                <report>dependencies</report>
                                <report>scm</report>
                                <report>cim</report>
                                <report>project-team</report>
                                <report>distribution-management</report>
                                <report>plugins</report>
                            </reports>
                        </plugin>
                        <plugin>
                            <artifactId>maven-surefire-report-plugin</artifactId>
                            <version>2.15</version>
                            <configuration>
                                <inherited>true</inherited> 
                                <aggregate>false</aggregate>
                            </configuration>
                        </plugin>
                        <plugin>
                            <groupId>org.jacoco</groupId>
                            <artifactId>jacoco-maven-plugin</artifactId>
                        </plugin>
                    </reportPlugins>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Aug 18, 2013

Member

@melloware as you can see - this issue still open, so was not fixed.

Member

Godin commented Aug 18, 2013

@melloware as you can see - this issue still open, so was not fixed.

@yamaduc

This comment has been minimized.

Show comment
Hide comment
@yamaduc

yamaduc Sep 27, 2013

This issue occurs with maven-surefire-plugin just by itself.

yamaduc commented Sep 27, 2013

This issue occurs with maven-surefire-plugin just by itself.

@mfriedenhagen

This comment has been minimized.

Show comment
Hide comment
@mfriedenhagen

mfriedenhagen Sep 27, 2013

Member

@yamaduc: do you multiple executions of surefire in your project? Or do you
run mvn install site? In the later case, the
maven-surefire-reporting-plugin might execute all plugin goals of the Maven
phase test again, which might lead to duplicate agents. You might consider
switching to the surefire-report-goals which only pick up existing runs :-)

Regards Mirko

Sent from my mobile
On Sep 27, 2013 7:27 AM, "yamaduc" notifications@github.com wrote:

This issue occurs with maven-surefire-plugin just by itself.


Reply to this email directly or view it on GitHubhttps://github.com//pull/40#issuecomment-25223843
.

Member

mfriedenhagen commented Sep 27, 2013

@yamaduc: do you multiple executions of surefire in your project? Or do you
run mvn install site? In the later case, the
maven-surefire-reporting-plugin might execute all plugin goals of the Maven
phase test again, which might lead to duplicate agents. You might consider
switching to the surefire-report-goals which only pick up existing runs :-)

Regards Mirko

Sent from my mobile
On Sep 27, 2013 7:27 AM, "yamaduc" notifications@github.com wrote:

This issue occurs with maven-surefire-plugin just by itself.


Reply to this email directly or view it on GitHubhttps://github.com//pull/40#issuecomment-25223843
.

@melloware

This comment has been minimized.

Show comment
Hide comment
@melloware

melloware Sep 27, 2013

@mfriedenhagen can you explain what you mean by only use the report goal? Our nightly builds on Jenkins perform the following task...

mvn clean deploy site:site

We get 80MB of stack straces due the "double agent" issue. How do you propose exactly we work around it?

melloware commented Sep 27, 2013

@mfriedenhagen can you explain what you mean by only use the report goal? Our nightly builds on Jenkins perform the following task...

mvn clean deploy site:site

We get 80MB of stack straces due the "double agent" issue. How do you propose exactly we work around it?

@yamaduc

This comment has been minimized.

Show comment
Hide comment
@yamaduc

yamaduc Sep 27, 2013

@mfriedenhagen

mvn clean test-compile integration-test

I added the -X and searched for Forking and noticed two -javaagent in the command.

yamaduc commented Sep 27, 2013

@mfriedenhagen

mvn clean test-compile integration-test

I added the -X and searched for Forking and noticed two -javaagent in the command.

@mfriedenhagen

This comment has been minimized.

Show comment
Hide comment
@mfriedenhagen

mfriedenhagen Sep 28, 2013

Member

@melloware: see https://github.com/1and1/foss-parent/blob/master/pom.xml#L987. When you run deploy, surefire and failsafe probably already did produce results, so you do not need the maven-surefire-report-plugin to run the tests again, so the reports report-only resp. failsafe-report-only are enough.

Member

mfriedenhagen commented Sep 28, 2013

@melloware: see https://github.com/1and1/foss-parent/blob/master/pom.xml#L987. When you run deploy, surefire and failsafe probably already did produce results, so you do not need the maven-surefire-report-plugin to run the tests again, so the reports report-only resp. failsafe-report-only are enough.

@mfriedenhagen

This comment has been minimized.

Show comment
Hide comment
@mfriedenhagen

mfriedenhagen Sep 28, 2013

Member

@yamaduc: depending on your project the phase initialize might be run multiple times, because some maven-plugins fork a second lifecycle which might run initialize again and the second lifecycle will append the second javaagent. Take a look in your log file which maven-plugin does fork a lifecycle.

Member

mfriedenhagen commented Sep 28, 2013

@yamaduc: depending on your project the phase initialize might be run multiple times, because some maven-plugins fork a second lifecycle which might run initialize again and the second lifecycle will append the second javaagent. Take a look in your log file which maven-plugin does fork a lifecycle.

@melloware

This comment has been minimized.

Show comment
Hide comment
@melloware

melloware Sep 30, 2013

@mfriedenhagen that worked great! Its a nice workaround to the issue. I think the only problem now would be that mvn site:site by itself would not work as its counting on the "package" or install goals to be run first correct?

melloware commented Sep 30, 2013

@mfriedenhagen that worked great! Its a nice workaround to the issue. I think the only problem now would be that mvn site:site by itself would not work as its counting on the "package" or install goals to be run first correct?

@mfriedenhagen

This comment has been minimized.

Show comment
Hide comment
@mfriedenhagen

mfriedenhagen Oct 1, 2013

Member

@melloware: you are right, verify (or the phase you bound jacoco:report to)
needs to run before.

Member

mfriedenhagen commented Oct 1, 2013

@melloware: you are right, verify (or the phase you bound jacoco:report to)
needs to run before.

@yamaduc

This comment has been minimized.

Show comment
Hide comment
@yamaduc

yamaduc Oct 1, 2013

@mfriedenhagen

I noticed the org.jacoco:jacoco-maven-plugin:prepare-agent is called two times
Which causes the double -javaagent entries..

I'm calling mvn clean test-compile integration-test so I'm not sure why it's calling test..

BTW how do we post formatted code ?

I want to post my pom.xml

Thanks

yamaduc commented Oct 1, 2013

@mfriedenhagen

I noticed the org.jacoco:jacoco-maven-plugin:prepare-agent is called two times
Which causes the double -javaagent entries..

I'm calling mvn clean test-compile integration-test so I'm not sure why it's calling test..

BTW how do we post formatted code ?

I want to post my pom.xml

Thanks

@marchof

This comment has been minimized.

Show comment
Hide comment
@marchof

marchof Oct 10, 2013

Member

@Godin I re-worked the implementation to also work with white spaces. Can you please review and merge this? It looks like this is an real issue for more and more users.

Member

marchof commented Oct 10, 2013

@Godin I re-worked the implementation to also work with white spaces. Can you please review and merge this? It looks like this is an real issue for more and more users.

@buildhive

This comment has been minimized.

Show comment
Hide comment
@buildhive

buildhive commented Oct 10, 2013

Java Code Coverage Tools » jacoco #118 SUCCESS
This pull request looks good
(what's this?)

marchof added a commit that referenced this pull request Oct 11, 2013

@marchof

This comment has been minimized.

Show comment
Hide comment
@marchof

marchof Oct 11, 2013

Member

I created a new squashed and rebased PR #146 which can be directly merged.

Member

marchof commented Oct 11, 2013

I created a new squashed and rebased PR #146 which can be directly merged.

marchof added a commit that referenced this pull request Oct 21, 2013

Merge pull request #146 from jacoco/issue-146
Rebased fix for issue #40 (doubled javaagent)
@marchof

This comment has been minimized.

Show comment
Hide comment
@marchof

marchof Oct 21, 2013

Member

Fixed with reworked PR #146.

Member

marchof commented Oct 21, 2013

Fixed with reworked PR #146.

@marchof marchof closed this Oct 21, 2013

@jacoco jacoco locked and limited conversation to collaborators Jan 11, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.