Skip to content

Instantly share code, notes, and snippets.

@Virtlink
Last active September 14, 2017 16:36
Show Gist options
  • Save Virtlink/7a7f7893db9e55ebb489 to your computer and use it in GitHub Desktop.
Save Virtlink/7a7f7893db9e55ebb489 to your computer and use it in GitHub Desktop.
POM file for IntelliJ plugin development with Maven support
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.contoso</groupId>
<artifactId>org.contoso.my-plugin.intellij</artifactId>
<version>0.1.0-alpha</version>
<packaging>jar</packaging>
<name>My plugin for IntelliJ</name>
<description>Use my plugin in IntelliJ IDEA.</description>
<properties>
<vendor.name>Contoso</vendor.name>
<vendor.url>http://www.contoso.org/</vendor.url>
<vendor.email>[email protected]</vendor.email>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<ij.plugin>true</ij.plugin>
<jdk.version>1.8</jdk.version>
<idea.version>14.1.4</idea.version>
<idea.foldername>idea-IC-141.1532.4</idea.foldername>
</properties>
<organization>
<name>Contoso</name>
<url>http://www.contoso.org/</url>
</organization>
<developers>
<developer>
<name>John Doe</name>
<email>[email protected]</email>
</developer>
</developers>
<licenses>
<license>
<name>LGPL 2.1 license</name>
<url>http://www.opensource.org/licenses/lgpl-2.1</url>
</license>
</licenses>
<scm>
<connection>scm:git:[email protected]:contoso/my-plugin-intellij.git</connection>
<developerConnection>scm:git:[email protected]:contoso/my-plugin-intellij.git</developerConnection>
<url>https://github.com/contoso/my-plugin-intellij</url>
</scm>
<!--
This POM file uses a local file repository to store the IntelliJ IDEA SDK tar.gz,
whose JARs are extracted in a subdirectory of the build directory (./target) for the compiler
to use. However, the IntelliJ SDK JARs are provided by IntelliJ at runtime.
This POM file is based heavily on this article:
http://labs.bsb.com/2013/11/how-to-manage-development-life-cycle-of-intellij-plugins-with-maven-2/
-->
<dependencies>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>org.jetbrains.intellij-ce</artifactId>
<version>${idea.version}</version>
<type>tar.gz</type>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<includes>
<include>**/plugin.xml</include>
</includes>
</resource>
<resource>
<filtering>false</filtering>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/plugin.xml</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>unzip-distribution</id>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeArtifactIds>org.jetbrains.intellij-ce</includeArtifactIds>
<outputDirectory>${project.build.directory}/dependency</outputDirectory>
<includes>**/*.jar</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<compilerArguments>
<extdirs>${project.build.directory}/dependency/${idea.foldername}/lib/</extdirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>compile-forms</id>
<phase>process-classes</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<path id="maven.plugin.complete.classpath">
<path refid="maven.plugin.classpath"/>
<fileset dir="${project.build.directory}/dependency/${idea.foldername}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<taskdef name="instrumentIdeaExtensions"
classname="com.intellij.ant.InstrumentIdeaExtensions"
classpathref="maven.plugin.complete.classpath"/>
<path id="sourcepath">
<dirset dir="${project.basedir}">
<include name="src/main/java"/>
<include name="src/main/resources"/>
</dirset>
</path>
<instrumentIdeaExtensions destdir="${project.build.outputDirectory}"
extdirs="${project.build.directory}/dependency/${idea.foldername}/lib"
includeantruntime="false">
<classpath refid="maven.compile.classpath"/>
<src refid="sourcepath"/>
</instrumentIdeaExtensions>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.8.0</version>
<scope>system</scope>
<systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>dev</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unzip-distribution</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment