How do I listen to run events within my own intellij plugin?


I want to implement my own hot deploy plugin, so I need to listen to the service's `Run` event and `Debugger` event.

I know that debug events need to use XDebuggerManagerListener and i got debugger event. 

now i have implemented RunManagerListener for the run event, but it doesn't work, I can't listen to the service startup message. What should I do?


RunManagerListener seems like a listener for run configuration management events, not execution events.

Please try with subscribing to com.intellij.execution.ExecutionManager#EXECUTION_TOPIC.


Thanks for your help, now I can get running events.

There is another problem that I want to add an agent before running or debugging by adding -javaagent agent.jar. What should I do to get the command when the service starts and add it.


When i use com.intellij.execution.process.BaseProcessHandler#getCommandLine got the java command.

How do I modify it now to achieve the purpose of adding the agent parameter.



Sorry to bother you again. I have a little problem now.

Ff I have a lib directory in the root directory of the plugin with a jar file in it, I want to get the path of this jar in the -javaagent parameter, this path How should I get it.

The directory structure is as follows

│  └─workflows
│  ├─libraries
│  └─modules
│  ├─agent.jar
│  └─wrapper
How can I get the path of agent.jar in lib?


Please check PathManager.getPluginsPath() or PluginManagerCore.getPlugin(<your plugin ID>).getPath().

Please keep posts focused on a single topic. It will be easier for other developers to find the answers they are looking for.


Please sign in to leave a comment.