Implement run configuration

Answered

Hey there!

I want to implement a specific run configuration for Minecraft Plugins. Repo

I need to add a run configuration and did that successfully, but I have problems to add the code that is supposed to run when the user runs it.
As I understand it, the class that overrides RunConfiguration must use getState() method to execute the code. However, I don't get how that is supposed to work. The example is not clear to me.

What I want to do in this run configuration is the following:
- If not existing, download BuildTools, and build the server jar
- Run Gradle or Maven build of the plugin and place it into the plugins folder
- Run the server (JVM-based, so preferable executing from code, otherwise the command would be java -jar server.jar [options])

Can you help me / Tell me what I have to do to get the steps mentioned above working? Thanks!

3 comments
Comment actions Permalink

Sorry for delay.

For downloading: see com.intellij.util.download.DownloadableFileService

Run Maven/Gradle Build: com.intellij.task.ProjectTaskManager

For running, see com.intellij.execution.application.ApplicationConfiguration as reference

0
Comment actions Permalink

Hi, thanks for the answer. I am not quite sure where to put that code, not how. I noticed that it goes into my own implementation of RunConfiguration and that it has something to do with the getState() method. However, it is not clear to me, what exactly to do in that method. The example is not clear to me.

0
Comment actions Permalink

Sorry for delay. The actual preparation work should be performed in RunConfiguration#getState() and return RunProfileState for the actual server process on success AFAIU your use case.

0

Please sign in to leave a comment.