Now that we know what a plugin is, let's aim at writing one! The first step in writing a JIRA plugin is to set up your environment, if you haven't done that already. In this recipe, we will see how to set up a local environment.
To make plugin development easier, Atlassian provides the Atlassian plugin software development kit (SDK). It comes along with Maven and a preconfigured settings.xml
to make things easier.
The Atlassian Plugin SDK can be used to develop plugins for other Atlassian products, including Confluence, Crowd, and so on, but we are concentrating on JIRA.
The following are the prerequisites for running the Atlassian Plugin SDK:
2990
,should be available. This is important because different ports are reserved for different Atlassian products.JAVA_HOME
is set properly and the command java -version
outputs the correct Java version details.SDK_HOME
going forward.bin
directory into the environment PATH
variable. If you are using the installer, this step is automatically done.M2_HOME
, pointing to the apache-maven
directory in your SDK Home. SDK version 4.x+ handles this step automatically.With the preceding steps executed properly, we have a development environment for JIRA plugins. You can verify the installation of the SDK by running the following command:
atlas-version
This command displays the version and runtime information of the installed SDK.
The next step is to create a skeleton plugin, import it into your IDE, and start writing some code! Creating the skeleton plugin, deploying it, and so on, is explained in detail in the following recipes.
If you face issues while downloading the dependencies using Maven, read on.
If you are behind a firewall, make sure you configure proxy in the Maven settings.xml
file. Proxy can be configured as follows:
<settings> ... <proxies> <proxy> <active>true</active> <protocol>http</protocol> <host>proxy.demo.com</host> <port>8080</port> <username>demouser</username> <password>demopassword</password> <nonProxyHosts>localhost|*.demosite.com</nonProxyHosts> </proxy> </proxies> ... </settings>
Find more about that and other aspects of Maven at http://maven.apache.org/index.html.
If you are a developer, in many cases you will have Maven already installed in your local machine. In that case, point the M2_HOME
directory to your local Maven and update the respective settings.xml
with the repository details in the default settings.xml
that ships with the Atlassian Plugin SDK.
Or you can simply add the following to the existing settings.xml
:
<pluginRepository> <id>atlassian-plugin-sdk</id> <url>file://${env.ATLAS_HOME}/repository</url> <releases> <enabled>true</enabled> <checksumPolicy>warn</checksumPolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository>
If you are using IntelliJ IDEA, it is an easy job because IDEA integrates Maven out of the box. Just load the project by selecting the pom.xml
! See https://developer.atlassian.com/docs/developer-tools/working-in-an-ide/configure-idea-to-use-the-sdk for details.
If you are using Eclipse, make sure you have M2Eclipse installed. This is because Eclipse integrates Maven through the Sonatype M2Eclipse plugin. You can find more details on configuring this at https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/set-up-the-eclipse-ide-for-linux or https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/set-up-the-eclipse-ide-for-windows, depending on the OS.
For NetBeans, see https://developer.atlassian.com/docs/developer-tools/working-in-an-ide/configure-netbeans-to-use-the-sdk.
If you see Maven download errors such as Could not resolve artifact
, make sure you verify the following:
settings.xml
is correct, that is, it points to the correct repositories.18.118.163.207