PageRenderTime 41ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/content/server/framework/atlassian-sdk/create-a-helloworld-plugin-project.md

https://bitbucket.org/zchristmas/atlassian-sdk-docs
Markdown | 169 lines | 131 code | 38 blank | 0 comment | 0 complexity | fc8689df3862dc932cc5cec608435ece MD5 | raw file
Possible License(s): LGPL-2.0
  1. ---
  2. aliases:
  3. - /server/framework/atlassian-sdk/create-a-helloworld-plugin-project-10422115.html
  4. - /server/framework/atlassian-sdk/create-a-helloworld-plugin-project-10422115.md
  5. category: devguide
  6. confluence_id: 10422115
  7. dac_edit_link: https://developer.atlassian.com/pages/editpage.action?cjm=wozere&pageId=10422115
  8. dac_view_link: https://developer.atlassian.com/pages/viewpage.action?cjm=wozere&pageId=10422115
  9. date: '2017-12-08'
  10. guides: tutorials
  11. legacy_title: Create a HelloWorld Plugin Project
  12. platform: server
  13. product: atlassian-sdk
  14. subcategory: learning
  15. title: Create a HelloWorld plugin project
  16. ---
  17. # Create a HelloWorld plugin project
  18. You now have a local development environment configured for the Atlassian SDK and you're ready to build your first Atlassian Server plugin! 
  19. **Important**: This guide explains how to build a plugin for Atlassian Server. If you meant to developing an app for Atlassian Cloud then [view the JIRA Cloud Getting Started guide](https://developer.atlassian.com/cloud/jira/platform/getting-started/).
  20. The plugin is going to be fairly simple, but you'll learn the fundamental steps for creating a plugin and starting up your application environment.  
  21. If you get stuck at any point, you can compare your progress to our <a href="https://bitbucket.org/serverecosystem/myplugin" class="external-link">myPlugin source code</a>.  The tutorial is tested to work with the Atlassian Plugin SDK 6.2.9.
  22. ## Step 1. Use the Atlassian SDK to build a plugin skeleton
  23. 1. Navigate to the directory on your system where you'd like to create your plugin.  The command we are about to run will create a folder with the plugin directories inside. 
  24. 2. Create an add-on project using the `atlas-create-jira-plugin` command from a **Command Prompt **window:
  25. ``` text
  26. atlas-create-jira-plugin
  27. ```
  28. This command is going to build a JIRA plugin skeleton using maven. Some logs appear on the screen showing maven commands that are being run and the version of JIRA that is being used. 
  29. 3. You will be prompted to provide some information about your plugin. For the purposes of this tutorial respond to the prompts as follows:
  30. ``` text
  31. Define value for groupId: : com.atlassian.tutorial
  32. Define value for artifactId: : myPlugin
  33. Define value for version: 1.0.0-SNAPSHOT: : 1.0.0-SNAPSHOT
  34. Define value for package: com.atlassian.tutorial: : com.atlassian.tutorial.myPlugin
  35. ```
  36. 4. You will then be prompted to confirm your configuration. Verify the details to ensure they are correct, and then type **Y** once you are ready to proceed:
  37. ``` text
  38. Confirm properties configuration:
  39. groupId: com.atlassian.tutorial
  40. artifactId: myPlugin
  41. version: 1.0.0-SNAPSHOT
  42. package: com.atlassian.tutorial.myPlugin
  43. Y: : Y
  44. ```
  45. The basic skeleton for your Atlassian JIRA plugin is created in a new `myPlugin` directory: 
  46. ``` text
  47. .
  48. ├── LICENSE
  49. ├── README
  50. ├── pom.xml
  51. └── src
  52. ├── main
  53. │ ├── java
  54. │ │ └── com
  55. │ │ └── atlassian
  56. │ │ └── tutorial
  57. │ │ └── myPlugin
  58. │ │ ├── api
  59. │ │ │ └── MyPluginComponent.java
  60. │ │ └── impl
  61. │ │ └── MyPluginComponentImpl.java
  62. │ └── resources
  63. │ ├── META-INF
  64. │ │ └── spring
  65. │ │ └── plugin-context.xml
  66. │ ├── atlassian-plugin.xml
  67. │ ├── css
  68. │ │ └── myPlugin.css
  69. │ ├── images
  70. │ │ ├── pluginIcon.png
  71. │ │ └── pluginLogo.png
  72. │ ├── myPlugin.properties
  73. │ └── js
  74. │ └── myPlugin.js
  75. └── test
  76. ├── java
  77. │ ├── it
  78. │ │ └── com
  79. │ │ └── atlassian
  80. │ │ └── tutorial
  81. │ │ └── myPlugin
  82. │ │ └── MyComponentWiredTest.java
  83. │ └── ut
  84. │ └── com
  85. │ └── atlassian
  86. │ └── tutorial
  87. │ └── myPlugin
  88. │ └── MyComponentUnitTest.java
  89. └── resources
  90. └── atlassian-plugin.xml
  91. ```
  92. Feel free to take a moment to explore the different files created by the Atlassian SDK before you continue. 
  93. ## Step 2. Start up JIRA with your plugin installed
  94. In this step, we'll use the `atlas-run` command to run the application (JIRA in this example) and install the plugin. Then we'll confirm that JIRA has started with the plugin created in *Step 1* already installed.   
  95. 1. Change to the `myPlugin` directory and enter the following command: 
  96. ``` text
  97.  atlas-run
  98. ```
  99. This is going to use the information in the plugin skeleton you created earlier to download JIRA and all of the other plugins it needs, then start JIRA with your plugin installed.  
  100. The first time you do this, it might take several minutes to complete.  
  101. Once JIRA has started, you'll see something like this in the Command Prompt window:
  102. ``` text
  103. [INFO] [talledLocalContainer] Aug 08, 2016 5:51:33 PM org.apache.catalina.startup.Catalina start
  104. [INFO] [talledLocalContainer] INFO: Server startup in 234207 ms
  105. [INFO] [talledLocalContainer] Tomcat 8.x started on port [2990]
  106. [INFO] jira started successfully in 332s at http://DESKTOP-EF2CA9N:2990/jira
  107. [INFO] Type Ctrl-D to shutdown gracefully
  108. [INFO] Type Ctrl-C to exit
  109. ```
  110. 2. Open a browser window and navigate to **<a href="http://localhost:2990/jira" class="uri external-link">localhost:2990/jira</a>**.  To login, use the credentials:
  111. | | |
  112. |----------|-------|
  113. | Username | admin |
  114. | Password | admin |
  115. 3. A Welcome dialog will appear and you'll be asked to configure some basic JIRA settings. 
  116. You'll only need to do this once for your plugin and the settings will be remembered the next time you use the `atlas-run` command.
  117. 4. Type **gg**, and then type **manage**.**  **From the list that appears, select **Manage add-ons**. 
  118. (Alternatively you can click on the cog icon at the top of the screen to open the administration dialog, and then select **Add-ons** and finally when the Atlassian Marketplace Administration page opens, select **Manage add-ons** on the right hand side). 
  119. 5. Locate the **myPlugin** listings in **User-installed add-ons** and click on them to expand. 
  120. One of the listings you see will be the plugin itself, the other will be the plugin tests. Notice that the plugins have a few basic modules that were created by the SDK.  
  121. 6. Close your browser, and return to the **Command Prompt** window where JIRA was running. 
  122. 7. Shutdown JIRA gracefully with **CTRL+D** (on OSX and Linux) or **CTRL+Z** (on Windows).
  123. ## Next step
  124. You have a basic plugin skeleton, so lets learn how to modify and customise it to provide a new menu in JIRA. 
  125. {{% note %}}
  126. **[Modify the Plugin](/server/framework/atlassian-sdk/modify-the-plugin)**
  127. {{% /note %}}
  128. ## Additional Resources
  129. The source code for this tutorial is available on Bitbucket at <a href="https://bitbucket.org/serverecosystem/myplugin" class="uri external-link">bitbucket.org/serverecosystem/myplugin</a>
  130. Alternatively, check out the [Getting Started Tutorial FAQ](/server/framework/atlassian-sdk/getting-started-tutorial-faq)
  131. Still need help? Request support at <a href="https://ecosystem.atlassian.net/servicedesk/customer/portal/14" class="external-link">Developer Technical Support Portal</a>