Skip to content
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

Mixing extra jvm arguments for the surefire-maven-plugin with jacoco #44

Closed
ghost opened this issue Nov 12, 2012 · 5 comments
Closed

Mixing extra jvm arguments for the surefire-maven-plugin with jacoco #44

ghost opened this issue Nov 12, 2012 · 5 comments
Assignees

Comments

@ghost
Copy link

ghost commented Nov 12, 2012

Noticed that the maven jacoco plugin appends the agent to the argLine property of the surefire plugin. Since I need to add some additional parameters to the jvm cmdline I ended up using something similar to this <argLine>-foobar ${argLine}</argLine> in order to preserve the jacoco agent. All works OK if I don't disable the jacoco plugin using the skip property. If I do that I end up with an argLine property which is not initialized and because of that the actual string "${argLine}" is appended to the jvm command line.

Is there a better way to handle extra surefire jvm arguments with the jacoco plugin?

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.12.1</version>
    <configuration>
        <forkMode>once</forkMode>
        <argLine>-foobar ${argLine}</argLine>
    </configuration>
</plugin>
<plugin>
  <groupId>org.jacoco</groupId>
  <artifactId>jacoco-maven-plugin</artifactId>
  <version>${jacoco.version}</version>
  <executions>
    <execution>
      <goals>
        <goal>prepare-agent</goal>
      </goals>
      <configuration>
        <skip>${jacoco.skip}</skip>
      </configuration>
    </execution>
    <execution>
      <id>report</id>
      <phase>prepare-package</phase>
      <goals>
        <goal>report</goal>
      </goals>
      <configuration>
        <skip>${jacoco.skip}</skip>
      </configuration>
    </execution>
  </executions>
</plugin>
@marchof
Copy link
Member

marchof commented Nov 12, 2012

BTW, the agent Ant task works the same way: If it is not enabled it sets the property to the empty string:

http://www.eclemma.org/jacoco/trunk/doc/ant.html#agent

@ghost
Copy link
Author

ghost commented Nov 21, 2012

Hi,

Not sure what the process is for having the patch reviewed and merged. Please let me know if you need further changes / info from me.

@Godin
Copy link
Member

Godin commented Nov 21, 2012

@isavin Hi, first of all - thanks for your contribution, I'll review patch as soon as possible on this week, when I'll have free time and that's why it's assigned to me ;)

@Godin
Copy link
Member

Godin commented Nov 21, 2012

Done in ca86383

@Godin Godin closed this as completed Nov 21, 2012
renataogarcia added a commit to renataogarcia/jacoco that referenced this issue Feb 12, 2014
mfriedenhagen added a commit that referenced this issue Feb 13, 2014
GitHub #44: (Regression) Agent Mojo should set empty property, if execution was skipped
@mfriedenhagen
Copy link
Member

@Controlix, you are right, there was a regression fixed with pull request
#192, which will be part of 0.6.5. So running the 0.6.5-SNAPSHOT should
work for you.

@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.
Projects
None yet
Development

No branches or pull requests

3 participants