jmc-build
jmc-build copied to clipboard
Deploy agent to maven central
Hi,
Would it be possible to deploy the agent to maven central? The objective would be to be able to use it programmatically during unit testing so that I can then use JFRUnit to assert things about JFR events.
I know that I can download it and attach it to the JVM but it would be more comfortable to have it as a maven dependency and do runtime attaching during the specific tests I am interested in monitoring.
Thanks!
It's not Maven Central, but you could look into using the Adoptium jmc-libs-snapshot repository available here: https://adoptium.jfrog.io/ui/repos/tree/General/jmc-libs-snapshots/org/openjdk/jmc/agent
In your pom add something like:
<repositories>
<repository>
<id>adoptium</id>
<name>Adoptium</name>
<url>https://adoptium.jfrog.io/artifactory/jmc-libs-snapshots/</url>
<layout>default</layout>
</repository>
</repositories>
and then can add a dependency such as:
<dependency>
<groupId>org.openjdk.jmc</groupId>
<artifactId>agent</artifactId>
<version>1.0.1-SNAPSHOT</version>
</dependency>
This topic of the Agent and maven central has come up a handful of times during JMC meetings going back to 2021, but there hasn't been a lot of progress on it. The JMC Agent is in a weird spot because it hasn't had an official release, and is treated as it's own sub-project under the JMC umbrella - it has it's own versioning and isn't distributed alongside JMC or it's core libraries. As such, at the moment the best I think you can get is a snapshot version, and it's nice Adoptium currently has it available.
@aptmac hey, this is not a so bad solution as it is meant to be used for testing and not production! Thanks a lot!
Feel free to close this or to keep it open as you prefer :)