apache / apache/maven-surefire

[SUREFIRE-2287] Dynamic agent loading feature

Open
#2,637 1 comment 5 reactions 0 assignees View on GitHub
enhancement priority:minor
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Maxim Kovalenko](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER307822)** opened **[SUREFIRE-2287](https://issues.apache.org/jira/browse/SUREFIRE-2287?redirect=false)** and commented

According to [JEP 451](https://openjdk.org/jeps/451) in JDK 21, the dynamic loading of agents is allowed but {**}the JVM issues a warning when it occurs{**}:

```java
WARNING: A {Java,JVM TI} agent has been loaded dynamically (file:/u/bob/agent.jar)
WARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning
WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information
WARNING: Dynamic loading of agents will be disallowed by default in a future release
```

In some future Java releases, the dynamic loading of agents will be disallowed by default.

Please add the "{_}agent{_}" ("{_}javaagent{_}" or "{_}dynamicAgent{_}") parameter to the 
_configuration_ definition that will be translated to _-javaagent_ option during tests execution.
 
See more details here: * https://openjdk.org/jeps/451
* https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#0.3
* https://github.com/mockito/mockito/issues/3037
* https://javadoc.io/doc/net.bytebuddy/byte-buddy-agent/1.10.4/net/bytebuddy/agent/ByteBuddyAgent.html

---

**Affects:** 3.5.2

Contributor guide

Open the contributing guide

Research direction

Start by tracing the configuration definition used during tests execution and how its parameters become JVM options. Implement the agent, javaagent, or dynamicAgent parameter so it translates to -javaagent, then verify the resulting test execution configuration against the JEP 451 behavior described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.