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

Load the agent into surefire forks #14

Open
dustinbyrne opened this issue Mar 19, 2021 · 2 comments
Open

Load the agent into surefire forks #14

dustinbyrne opened this issue Mar 19, 2021 · 2 comments

Comments

@dustinbyrne
Copy link
Contributor

The following configuration will not load the agent:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${maven-surefire-plugin.version}</version>
    <configuration>
        <forkCount>0</forkCount>
        <reuseForks>true</reuseForks>
        <argLine>
            --illegal-access=permit
        </argLine>
    </configuration>
</plugin>
@ptrdvrk
Copy link
Contributor

ptrdvrk commented Mar 19, 2021

Two issues:

  1. forking must be enabled for a new JVM with the -javaagent parameter to be forked
  2. argLine requires a reference of the argLine prepared by upstream plugins

The following configuration works:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${maven-surefire-plugin.version}</version>
    <configuration>
        <forkCount>1</forkCount>
        <reuseForks>true</reuseForks>
        <argLine>
            @{argLine} --illegal-access=permit
        </argLine>
    </configuration>
</plugin>

@ptrdvrk
Copy link
Contributor

ptrdvrk commented Apr 15, 2021

@dustinbyrne shall we close this one? Forking is required for the agent to work as you cannot attach it to an existing running JVM (where the tests are run if forkCount==1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants