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-zip
in the root directory of your project. This creates a file namedgenerated-test-resources.zip
in\target\jira\
subdirectory. - copy the
generated-test-resources.zip
file to\src\test\resources
. - edit project’s
pom.xml
and add the following line to thejira-maven-plugin
(ormaven-jira-plugin
depending 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
:
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.properties
file will be generated in\target\jira\webapp\WEB-INF\classes\
directory. - copy the file into
\src\test\resources
directory. -
make necessary changes to the
log4j.properties
in yourtest\resources
directory. For example, to enable DEBUG level logging to both console and log file forcom.test.jira.plugins
package, add the following lines at the end of the file:log4j.logger.com.test.jira.plugins = DEBUG, console, filelog
log4j.additivity.com.test.jira.plugins = false
- edit project’s
pom.xml
and add the following line to thejira-maven-plugin
(ormaven-jira-plugin
depending 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:
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