简体   繁体   中英

How to manage dependencies for javaagent?

I am using elastic apm agent for monitoring, I have to download the apm-agent.jar and included it in my start entry point like java -javaagent:/path/to/apm-agent.jar app.jar .

The problem is I have to manually download the apm-agent.jar, is there a way that I can configure the apm agent in my Gradle dependencies? and then refer to the path of the jar file that was downloaded by gradle in the Dockerfile?

What is the proper way of dependency management for jar files like java agent?

Are you not building a custom Dockerfile and you could just add it there (using wget or curl probably)?

If you really want a build dependency, https://search.maven.org/artifact/co.elastic.apm/elastic-apm-agent/1.7.0/jar should be what you want.

PS: IMO it's a feature that this is only a runtime dependency and you can just add, remove, change it independently of your application; unless you want to do some custom instrumentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM