Is there a way to build a plugin with a script (ant, gradle)


I would like to prepare a plugin to be packaged. I know there is an UI action for that "Build > Prepare Plugin Module ..."
However I would like to be able to run a script instead.

There are several reason for that,
- one is to be able to compile the project with some continuous integration server,
- another is that I need to package in zip file native libs, which is not supported by IntelliJ IDEA.

Thanks in advance for any information.

Comment actions Permalink

It is just a ZIP file so you can use the script of your choice (we use maven at work). Just put all jars inside yourpluginname/lib in the ZIP file and make sure that META-INF/plugin.xml ends up in one of your jars.

If you use IntelliJ UI forms in your plugin you will have to compile them with the javac2 task. Example with maven/ant:

    <taskdef name="javac2" classname="com.intellij.uiDesigner.ant.Javac2" classpathref="plugin.classpath" />
    <javac2 srcdir="${basedir}/src" destdir="${basedir}/target/classes" classpathref="plugin.classpath" />

Comment actions Permalink


you can use Build | 'Generate Ant Build' action to generate a build.xml file for your project. The generated ant script will contain a target to build
the plugin jar.

Nikolay Chashnikov
Software Developer
JetBrains, Inc
"Develop with pleasure!"

Comment actions Permalink

Here is the one I use to build mine.

I just hacked it together. It isn't an example of a well written build file, but maybe it will help you write yours.

Comment actions Permalink

That's great, thanks.

Now that gralde is out, that would be nice to have gradle support as well.
Anyway thanks for the help :)


Comment actions Permalink

By the way, here's my custom build script. It's based on the generated file from IntelliJ (OSX).

I will probably customize it further, in order to be able to use it on Windows and Linux as well.

Thanks for the help :)


Please sign in to leave a comment.