This project requires JVM version of at least 1.7
gradle-intellij-plugin
This plugin allows you to build plugins for IntelliJ platform using specific IntelliJ SDK and bundled plugins.
The plugin adds extra IntelliJ-specific dependencies, patches processResources tasks to fill some tags
(name, version) in plugin.xml
with appropriate values, patches compile tasks to instrument code with
nullability assertions and forms classes made with IntelliJ GUI Designer and provides some build steps which might be
helpful while developing plugins for IntelliJ platform.
Usage
Gradle >= 2.1
plugins {
id "org.jetbrains.intellij" version "0.2.17"
}
Gradle < 2.1
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.org.jetbrains:gradle-intellij-plugin:0.2.17"
}
}
apply plugin: 'org.jetbrains.intellij'
Snapshot
buildscript {
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url 'http://dl.bintray.com/jetbrains/intellij-plugin-service'
}
}
dependencies {
classpath "org.jetbrains.intellij.plugins:gradle-intellij-plugin:0.3.0-SNAPSHOT"
}
}
apply plugin: 'org.jetbrains.intellij'
Tasks
Plugin introduces following tasks
patchPluginXml
collects all plugin.xml files in sources and fill since/until build and version attributesprepareSandbox
creates proper structure of plugin, copies patched plugin xml files and fills sandbox directory with all of itbuildPlugin
assembles plugin and prepares zip archive for deploymentrunIde
executes IntelliJ IDEA instance with the plugin you are developing installed inpublishPlugin
uploads plugin distribution archive to http://plugins.jetbrains.com
Available in SNAPSHOT:
verifyPlugin
validates plugin.xml and plugin's structure
Configuration
Plugin provides following options to configure target IntelliJ SDK and build archive
-
intellij.version
defines the version of IDEA distribution that should be used as a dependency. The option accepts build numbers, version numbers and two meta valuesLATEST-EAP-SNAPSHOT
,LATEST-TRUNK-SNAPSHOT
.
Value may haveIC-
,IU-
orJPS-
prefix in order to define IDEA distribution type.
Default value:LATEST-EAP-SNAPSHOT
-
intellij.localPath
defines path to locally installed IDEA distribution that should be used as a dependency. The option accepts path, e.g./Applications/IntelliJIDEA.app
intellij.version
andintellij.localPath
should not be specified at the same time.
Default value:null
-
intellij.type
defines the type of IDEA distribution:IC
for community version,IU
for ultimate,JPS
for jps-only dependencies andRD
for Rider.
Default value:IC
-
intellij.plugins
defines the list of bundled IDEA plugins and plugins from idea repository that should be used as dependencies in formatorg.plugin.id:version[@channel]
. E.g.plugins = ['org.intellij.plugins.markdown:8.5.0.20160208', 'org.intellij.scala:2017.2.638@nightly']
. For bundled plugins a plugin's directory should be used as a name and a version should be omitted, e.g.plugins = ['android', 'Groovy']
. You can can also specify a Gradle subproject as a plugin dependency, e.g.plugins = [project(':plugin-subproject')]
.
Default value:<empty>
-
intellij.pluginName
is used for naming target zip-archive and defines the name of plugin artifact. of bundled IDEA plugins that should be used as dependencies.
Default value:$project.name
-
intellij.sandboxDirectory
defines path of sandbox directory that is used for running IDEA with developing plugin.
Default value:$project.buildDir/idea-sandbox
-
intellij.instrumentCode
defines whether plugin should instrument java classes with nullability assertions. Also it might be required for compiling forms created by IntelliJ GUI designer.
Instrumentation code cannot be performed while using Rider distributionsRD
.
Default value:true
-
intellij.updateSinceUntilBuild
defines whether plugin should patchplugin.xml
with since and until build values, if true thenIntelliJIDEABuildNumber
will be used as asince
value andIntelliJIDEABranch.*
will be used as an until value.
Default value:true
-
intellij.sameSinceUntilBuild
defines whether plugin should patchplugin.xml
with "open" until build. if true then the sameIntelliJIDEABuildNumber
will be used as asince
value and as an until value, which is useful for building plugins against EAP IDEA builds.
Default value:false
-
intellij.downloadSources
defines whether plugin should download IntelliJ sources while initializing Gradle build. Since sources are no needed while testing on CI, you can set it tofalse
for particular environment.
Default value:true
unless theCI
environment variable is set -
intellij.systemProperties
defines the map of system properties which will be passed to IDEA instance on executingrunIdea
task and tests.
Also you can useintellij.systemProperty(name, value)
method in order to set single system property.
Deprecated. UsesystemProperties
methods of a particular tasks likerunIde
ortest
.
Default value:[]
-
intellij.alternativeIdePath
– absolute path to the locally installed JetBrains IDE. It makes sense to use this property if you want to test your plugin in WebStorm or any other non-IDEA JetBrains IDE. Empty value means that the IDE that was used for compiling will be used for running/debugging as well.
Default value:<empty>
-
intellij.ideaDependencyCachePath
– absolute path to the local directory that should be used for storing IDEA distributions. If empty – Gradle cache directory will be used. Default value:<empty>
Patching plugin.xml
The patchPluginXml
task supports following properties:
-
version
is a value for<version>
tag.
Default value:<project.version>
-
sinceBuild
is a value for<idea-version since-build="">
attribute.
Default value:<IntelliJIDEABuildNumber>
-
untilBuild
is a value for<idea-version until-build="">
attribute.
Default value:<IntelliJIDEABranch.*>
-
pluginDescription
is a value for<description>
tag.
Default value: null -
pluginXmlFiles
is a collections of xml files to patch.
Default value:<all plugin.xml files with idea-plugin root tag in resources>
-
destinationDir
is a directory to store patched xml files.
Default value:<project.buildDir>/patchedPluginXmlFiles
Publishing plugin
`intellij.publish.* properties are deprecated
intellij.publish.username
your login at JetBrains plugin repository.intellij.publish.password
your password at JetBrains plugin repository.intellij.publish.channel
defines channel to upload, you may use any string here, empty string means default channel.intellij.publish.channels
defines several channels to upload, you may use any comma-separated strings here,default
string means default channel.
Default value:<empty>
publishPlugin
task supports following properties:
-
username
is a login at JetBrains plugin repository. -
password
is a password at JetBrains plugin repository. -
channels
are channels names to upload the plugin to.
Default value:[default]
-
host
host of plugin repository.
Default value:http://plugins.jetbrains.com
-
distributionFile
is a file to upload.
Default value:<output of buildPlugin task>
build.gradle
plugins {
id "org.jetbrains.intellij" version "0.2.17"
}
intellij {
version 'IC-2016.1'
plugins = ['coverage', 'org.intellij.plugins.markdown:8.5.0.20160208']
pluginName 'MyPlugin'
publish {
username 'zolotov'
password 'password'
channel 'nightly'
}
}
Getting started
Here is the manual on how to start developing plugins for IntelliJ IDEA using Gradle.
Examples
As examples of using this plugin you can check out following projects:
- Go plugin and its TeamCity build configuration
- Erlang plugin and its TeamCity build configuration
- Rust plugin and its TeamCity build configuration
- AWS CloudFormation plugin and its TeamCity build configuration
- Bash plugin and its TeamCity build configuration
- Perl5 plugin and its Travis configuration file
- Android Drawable Importer plugin
- Android Material Design Icon Generator plugin
- AceJump plugin
- Uses the Gradle Kotlin DSL
- EmberJS plugin
- GCloud plugin
- HCL plugin
- Robot plugin
- TOML plugin
- SQLDelight Android Studio Plugin
- idear plugin
- Uses the Gradle Kotlin DSL
- Android WiFi ADB plugin
- SonarLint plugin
- IdeaVim plugin and its TeamCity build configuration
- Adb Idea is configured to build and run against stable, beta or preview (canary) releases of Android Studio
- Gerrit uses Travis CI inclusive automated publishing of releases to GitHub and JetBrains plugin repository (triggered by version tag creation)
- .ignore
- Minecraft Development and its TeamCity build configuration
- Uses the Gradle Kotlin DSL
- Mixes Java, Kotlin, and Groovy code
- Uses Grammar Kit
- Uses a Kotlin version not bundled with IntelliJ
- Mainframer Integration
- Uses the Gradle Kotlin DSL
- Fully written in kotlin
- Uses RxJava
- Unity 3D plugin for JetBrains Rider
License
Copyright 2017 org.jetbrains.intellij.plugins
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.