mavenprofilingmaven-surefire-pluginasync-profiler

Passing artifactId to surefire argLine


I'm trying to use async-profiler with maven, sadly it does not track forked processes and my tests need the isolation provided by forks to run correctly.

In order to run async-profiler I need to run java with this parameter:

-agentpath:/path/to/libasyncProfiler.so=start,svg,file=profile.svg

I was thinking using surefire's argLine, but it would erase profile.svg each time. I was thinking using the project's artifactId do parameterized it, but I found no reference on that.

How can get the artifactId on the tested project in the argLine field?

Thanks by advance.


Solution

  • See Introduction to the POM, Project Model Variables:

    Any field of the model that is a single value element can be referenced as a variable.

    For your case it's ${project.artifactId}. Use this in Surefire configuration's <argLine>.