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. 在2022年11月23日星期三 UTC+8 21:47:07<Marc R. Hoffmann> 写道: > Hi, > > this is not supported and there are no plans to do so. Depending on the > instrumentation strategy the schema of the class files needs to be changed, > which is not supported by the JVM, > > Out of curiosity, what is your use case for this? > > Regards, > -marc > > On 23. Nov 2022, at 12:24, Jun Fu <fuju...@gmail.com> wrote: > > Hi guys, > Is it possible to dynamically inject Jacocoagent.jar into an already > running jvm without restarting?such as injecting through agentmain? > > -- > You received this message because you are subscribed to the Google Groups > "JaCoCo and EclEmma Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jacoco+un...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jacoco/a6399ba7-2a85-4eaa-aebc-79b0a8c50437n%40googlegroups.com > > <https://groups.google.com/d/msgid/jacoco/a6399ba7-2a85-4eaa-aebc-79b0a8c50437n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > > -- You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/8ff53f60-1835-422a-b11e-2a5e34f4f3f2n%40googlegroups.com.