Build JIRA Plugins Using Apache Ivy/Ant
Atlassian Plugin SDK comes with a custom maven distribution and build and test system based on maven. As with other maven projects, customising the build process is difficult and time intensive.
In our projects, we need the ability to include Groovy classes as part of the plugin sources. There was no easy way to include the Groovy class compilation phase into the maven system. We decided to develop our own ant and ivy based build system similar to the build system we use for all our projects to address the situation. The only downside of this is that we lose the maven based command-line plugin install system which speeds up the plugin install process before testing. On the bright side, this removes the necessity to download the Atlassian Plugin SDK and modify the PATH environment to use the supplied maven.
The directory structure adopted (shown below) for the plugin project is similar to the standard SPT project structure that is adopted for all our projects.
Apache Ivy is used as the dependency management system, since it integrates seamlessly into the very flexible and easy to use Ant build system. The ivy dependency configuration file shows the various dependencies we required for our plugin project. Note that the exclude list excludes all the libraries that are included in the groovy-all jar file that is available from the Groovy installation. A custom ivy settings file was necessary to add the Atlassian maven repository to the repository search path. Lastly a standard ant build script and associated properties file was used to build the plugin jar file.
To summarise, the following are the files necessary to build the plugin:
Plugins are developed and distributed as jar files with a few custom settings used by the Atlassian plugin system. The Atlassian plugin system uses OSGI to load and configure the plugins dynamically. The following are the customisations to the jar file necessary to comply with the plugin management system.
- Include the config/atlassian-plugin.xml at the root of the jar file hierarchy.
- Include all libraries required for the module in the META-INF/lib directory of the jar file (Note: you may also chose to aggregate all the jar file into a single jar)
- Include all resources (Velocity templates, images, CSS etc) into the jar file.
The following is a sample structure for a plugin jar file
Once the plugin jar file has been created, you can install to a running JIRA system through the administration section.