Reputation: 5215
I am developing an idea plugin, and it is an intellij idea project.
I want to use gradle to manage the dependency.
How to config?
Upvotes: 8
Views: 4979
Reputation: 2025
There is now a Gradle plugin for building IntelliJ Platform Plugins. In order to use it, you will need to add the following snippet to your build.gradle
file.
plugins {
id "org.jetbrains.intellij" version "0.0.31"
}
apply plugin: 'org.jetbrains.intellij'
For more information, please see this guide to help you get started.
Upvotes: 2
Reputation: 40378
Ok, there are multiple ways to create an IntelliJ project, "templates" if you like, and unfortunately you can only pick one of them (IntelliJ plugin or gradle).
Thankfully, it's easy to configure a project for gradle in IntelliJ.
First, create a new project from the IntelliJ Platform Plugin
template. You don't need to choose any Additional Libraries and Frameworks. This will give you a project structure including META-INF/plugin.xml
and the Project SDK
should be something like IDEA IU-129.451
.
From here, simply create a new file named build.gradle
at the top level of your project, including for example this line:
apply plugin: 'java'
Now, close the project. You can now use File
-> Import Project...
, choose the build.gradle
file that you just created, and import the project. Accept the defaults for importing and hit OK.
The project is now opened with both gradle and intellij plugin enabled!
Notice that the source root src
has disappeared and you will need to right click on src
in the Project pane and select Mark Directory As
-> Source Root
.
To prepare the plugin for deployment, there is still the menu option in the Build
menu for that - if you want to automate that part via gradle, good luck and please let us know how it's done ;)
Upvotes: 0