How do I keep monitoring that a user has successfully run his Java project once?

Answered

I want to monitor every time a user successfully runs a Java project, and every successful run has to be monitored to get me to make some response

0
5 comments

Hi,

Please try implementing com.intellij.execution.ExecutionListener (processTerminated()) and subscribe to com.intellij.execution.ExecutionManager#EXECUTION_TOPIC.
In the implementation, you should:

  • check if the executorId is the one you are interested in (Run, Debug, etc.)
  • executionEnvironment.getRunProfile() is of the type you want to monitor, e.g., com.intellij.execution.application.ApplicationConfiguration
  • the exit code was successful

For information about listeners, see:

0

I'm sorry, I'm going to implement this feature on the basis of intellij2020, the method you said doesn't seem to be very compatible, is there any way to implement my needs on intellij2020

0

Hi,

What is not compatible? Please always provide the details in your questions.

0

Hi,in the intellij2020 project, I want to use ExecutionEvent, but it gives an error that the class cannot be found and cannot be imported, so I can't use this method.

And this is the version of ExecutionListener I use.

0

I don’t understand the issue at all.

The ExecutionListener interface looks like on your second screenshot and hasn’t changed since 2016. Where did you get the one with ExecutionEvent as the parameter?

0

Please sign in to leave a comment.