adoptium / jmc-build

Contains the Adoptium specific source code overrides and build pipeline script for the Java Mission Control project.
Apache License 2.0
22 stars 9 forks source link

Deploy agent to maven central #61

Open victornoel opened 5 months ago

victornoel commented 5 months ago

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!

aptmac commented 5 months ago

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.

victornoel commented 5 months ago

@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 :)