简体   繁体   中英

Can VisualVM be used for profiling Maven Projects? If yes then how?

I want to profile a Maven project using JVisualVM. In eclipse in the run configurations there is nothing for running the maven build in VisualVm. Next I tried running the VisualVM application and profiling the projects, the jar files that get created when I do mvn -install were my choice of input. However, even those don't really work.

Is there a way to generate a FUNCTIONAL profile of a maven project. I dont want to know the CPU usage and stuff, rather I am interested in the execution flow of the project ie how the methods are being called and executed and when/where are they interacting (basically TRACE of the program).

If there are some other tools also please feel free to suggest.

Maven is a build tool . VisualVM profiles Java processes . A running process can be built with Maven and profiled with VisualVM, but they have no relation to each other. VisualVM is a profiler, it's not used to trace the execution of a program except for hotspots caught by the profiler.

If you want to trace maven itself, use the -X argument.

mvn -X clean install

It's not a profile, but that's what "the execution flow of the project ie how the methods are being called and executed" means at build time.

If you want to actually profile your program at runtime (not maven), then the fact that it was built with maven, ant or gradle does not matter. You need to foresee something in your own code to log the information (tools may be available depending on the libraries you use).

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