Hi,
My case is, I use a linux virtual machine with a docker installed. My springboot project is deployed in the docker and is running. I want to run local interface tests and get code coverage data of the springboot project.
As far as I know, I can use '-javaagent:[yourpath/]jacocoagent.jar=[option1]=[value1],[option2]=[value2]' to inject jacocoagent.jar into this docker, but I need to modify the startup script of the docker container and
restart. Because this docker container will reset all additional actions every time it is updated and this springboot project interface will be called,so in order to reduce impact,I want to attach a running jvm without
restarting.
I'm not sure I have described the case clearly?
I learned that the agent.jar can be dynamically attached to a running java process through javaagent (agentmain), that is, the dynamic instrument after the JVM starts. When the class has been loaded, it could use
Instrumentation#retransformClasses to retransform the corresponding class. But it seems that jacoco does not support this now, so I don't know how to implement it.
Thanks.