6

I need some help getting started making a specific IntelliJ plugin.

I want to make an IntelliJ plugin that makes it so you can launch intelliJ actions from CLI (or from a web service if it's easier).

For example, I'm done building my project with a gradle script... but i want to get it ready in intelliJ too. Right now I have to do this manually with a point-and-clicks.

Instead I want to have this the ability to externally trigger some IntelliJ commands. In my example I would want to fire off these requests from my gradle script:

  • run-intellij-command {project-path} --action refresh-gradle
  • run-intellij-command {project-path} --action build-project
  • run-intellij-command {project-path} --action start-debugging --configurationName={configuration-name}

Does anyone have an example of how I can get started with this?

Really hoping there is an intellij plugin project that already does something similar like reacting to cli commands or hosts a web service that can be called?

Thanks!

Also created this https://youtrack.jetbrains.com/issue/IDEA-184885 hoping to see this feature become a reality some day

yole
  • 92,896
  • 20
  • 260
  • 197
Nicholas DiPiazza
  • 10,029
  • 11
  • 83
  • 152

1 Answers1

4

You can use the ApplicationStarterEx interface to implement that. Provide a class implementing the interface, and register it in your plugin.xml as the <appStarter> extension point.

To execute your code, use Tools | Create Command-line Launcher, and then run idea <startername> <arguments> from the command line, where startername is what you return from ApplicationStarter.getCommandName().

I'm not aware of any existing open-source plugins that implement similar functionality.

yole
  • 92,896
  • 20
  • 260
  • 197