How to keep JIRA settings after cleaning a project
Normally, when you run atlas-clean command, you loose JIRA configuration and have to start over when you run your development instance again.
Luckily there’s a way to keep both your JIRA configuration and log4j settings after cleaning the target directory.
These instructions have been tested in JIRA 7.13.9.
Even though it’s a documented feature of Atlassian SDK, I learned about it in the JIRA Development Cookbook by Jobin Kuruvilla. It’s a great book to learn the basics when starting JIRA development.
Let’s see how to keep JIRA settings first and then the log4j settings.
Keeping JIRA settings
Here’s what you need to do:
- stop your JIRA instance, if it’s running.
- run
atlas-create-home-zipin the root directory of your project. This creates a file namedgenerated-test-resources.zipin\target\jira\subdirectory. - copy the
generated-test-resources.zipfile to\src\test\resources. - edit project’s
pom.xmland add the following line to thejira-maven-plugin(ormaven-jira-plugindepending on your AMPS version) configuration section:<productDataPath>${project.basedir}/src/test/resources/generated-test-resources.zip</productDataPath>
Here’s how the plugin configuration looks like in pom.xml:
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>jira-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<productDataPath>${project.basedir}/src/test/resources/generated-test-resources.zip</productDataPath>
<!-- ... -->
</configuration>
</plugin>
</plugins>
</build>Any time you do any configuration changes to JIRA, just generate a new generated-test-resources.zip file and copy it to the \src\test\resources directory.
Keeping log4j settings
Keeping log4j settings is similar:
- run your JIRA development instance at least once. A
log4j.propertiesfile will be generated in\target\jira\webapp\WEB-INF\classes\directory. - copy the file into
\src\test\resourcesdirectory. -
make necessary changes to the
log4j.propertiesin yourtest\resourcesdirectory. For example, to enable DEBUG level logging to both console and log file forcom.test.jira.pluginspackage, add the following lines at the end of the file:log4j.logger.com.test.jira.plugins = DEBUG, console, fileloglog4j.additivity.com.test.jira.plugins = false - edit project’s
pom.xmland add the following line to thejira-maven-plugin(ormaven-jira-plugindepending on your AMPS version) configuration section:<log4jProperties>${project.basedir}/src/test/resources/log4j.properties</log4jProperties>
Here’s how the plugin configuration looks like in pom.xml, including the productDataPath configuration from previous section:
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>jira-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<productDataPath>${project.basedir}/src/test/resources/generated-test-resources.zip</productDataPath>
<log4jProperties>${project.basedir}/src/test/resources/log4j.properties</log4jProperties>
<!-- ... -->
</configuration>
</plugin>
</plugins>
</build>And that’s it. This is one of the first things I do when creating a new project and setting up JIRA after the first execution.
Comments