You should understand the basic contents and functions of the SDK before you develop your first add-on. On this page, you get a summary of the SDK contents, a very brief intro to Apache Maven, and you run an Atlassian application through the SDK. The following topics are covered:
Maven is a popular tool and you may already be using it. You don't need to be a Maven expert to use this tutorial. You do need to understand some Maven basics to develop with the SDK. Examine the contents of the SDK installation:
Navigate to the directory where the Atlassian SDK (the ATLAS_HOME) was installed.
Not sure where the SDK was installed? Use the atlas-version
command. If you are on a Mac or other Linux system you may need to preface your command with sudo
.
List the contents of the ATLAS_HOME
directory.
The SDK contains the following directories:
Directory | Description |
---|---|
| Contains the Apache Maven 2 installation. Maven is a popular build management tool. Atlassian built a suite tools around Maven called the Atlassian Maven Plugin Suite (AMPS). These tools automate many add-on development tasks. |
| Contains command-line wrappers for the most common AMPS calls. All of the commands start with the |
| Contains code repositories that the Atlassian SDK is dependent on. This directory is prepopulated during the SDK installation. |
Take some time to list the contents of each of the three sub-directories.
Maven relies on the ability to navigate to external repositories URLs and obtain source packages required by your code. When you build an add-on such as a plugin using the SDK's atlas-
commands, Maven is behind the scenes retrieving the latest Atlassian source files from Atlassian's public repositories. Atlassian preconfigures the location of these repositories in the ATLAS_HOME/apache-maven/conf/settings.xml
file.
settings.xml
If you're doing your development behind a corporate firewall, you may need to connect to the Internet through an HTTP proxy. If you know you do not have a firewall, skip this procedure. If you know your company requires you to use an HTTP proxy, you need to configure proxy settings in the ATLAS_HOME/apache-maven/conf/settings.xml
file. Do the following:
Ask your system administrator to provide you with the following information:
The proxy address protocol://host:port, for example our.company:8080.
a username/password required for access
a list of hosts that don't require a proxy
Edit the ATLAS_HOME/apache-maven/conf/settings.xml
file in your favorite editor.
Locate the <proxies>
section.
Uncomment the proxy
element.
Edit the proxy
element and add the values provided by your system administrator.
When you are done, the element looks similar to the following:
1 2<proxies> <proxy> <id>myproxy</id> <active>true</active> <protocol>http</protocol> <host>proxy.somewhere.com</host> <port>8080</port> <username>proxyuser</username> <password>somepassword</password> <nonProxyHosts>*.google.com|ibiblio.org</nonProxyHosts> </proxy> </proxies>
Close and save the file.
Have an Existing settings.xml File in Your .m2 Directory?
If you have an existing local settings.xml
file, you may encounter problems resolving dependencies required by the SDK commands. To prevent these problems, add the following <pluginRepository>
block to your local settings.xml
profile:
1 2<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>
At this point, you've configured your environment and you are set to begin developing. This tutorial shows you how to add a very simple helloworld
plugin to JIRA. Before you begin writing code, you should use an atlas
command to run JIRA in standalone mode. You use the atlas-run-standalone command to start JIRA.
If you haven't already done so, open a command window and do the following:
Navigate to the root of your drive (Windows) or home directory (Linux).
Windows | Linux/Mac |
---|---|
|
|
Create a directory called atlastutorial
.
1 2mkdir atlastutorial
Change directory to your newly created directory.
1 2cd atlastutorial
Start latest version of JIRA on default port of 2990, by entering the following:
1 2atlas-run-standalone --product jira
After the command completes successfully you see a message similar to the following:
1 2[INFO] Starting jira on the tomcat6x container on ports 2990 (http) and 52641 (rmi) [INFO] using codehaus cargo v1.2.3 [INFO] [cargo:start] [INFO] [2.ContainerStartMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-tomcat:jar:1.2.3 for container tomcat6x [INFO] [stalledLocalDeployer] Deploying [/Users/manthony/atlastutorial/amps-standalone/target/jira/jira.war] to [/Users/manthony/atlastutorial/amps-standalone/target/container/tomcat6x/cargo-jira-home/webapps]... [INFO] [talledLocalContainer] Tomcat 6.x starting... [INFO] [talledLocalContainer] Tomcat 6.x started on port [2990] [INFO] jira started successfully in 249s at http://localhost:2990/jira [INFO] Type Ctrl-D to shutdown gracefully [INFO] Type Ctrl-C to exit
The output message tells you the URL where JIRA was started.
Open a browser and enter the JIRA URL.
You should see the URL for your installation displayed in the run output. For example, you might see myhost.local:2990/jira or localhost:2990/jira depending on your environment. On successful launch, the browser displays the JIRA login page.
Enter admin
for both the username and password.
Your browser displays the JIRA dashboard:
You'll notice in the Admin section the License that you are running is a Test license for plugin developers
.
When you issue the atlas-run-standalone
command, it creates a directory called amps-standalone
in the current directory - in this case atlastutorial/amps-standalone
.
JIRA runs as a Tomcat web application on your localhost
-- the system on which you issue the command. So, the command actually runs a Maven build on your system. This build
amps-standalone/target
in the current atlastutorial
directoryThe amps-standalone/target/jira-5.0.log
file contains the details such as the environment variables set and used during this process. You'll notice from this log file that the JIRA test instance relies on an HSQL database. You would never use an HSQL database in a production system.
When you run a standalone instance, you can make changes in the instance. The system remembers what you do between sessions. At this point, you should still have your standalone JIRA instance up and running. Make sure you are logged in and do the following:
Test Project
and give it a key of TEST
.Your browser should inform you that it could not get a connection to the server.
Return to the command line (DOS prompt for Windows users).
Make sure you are in the atlastutorial
directory.
Restart JIRA standalone.
1 2atlas-run-standalone --product jira
Log back in and locate your project.
The standalone instance has retained the data you created between restarts. This can be very useful when testing. You'll learn more about this later.
Extra Exploration
You can use the atlas-run-standalone
command to run a particular version of a product. This is useful if, for instance, you want to test your code on an earlier version of JIRA or Confluence. Review the command's reference page and try running an earlier version of JIRA.
At this point, you have some basic understanding of the SDK. Enough to go ahead in the next tutorial section to create your own plugin project.
Rate this page: