PageRenderTime 57ms CodeModel.GetById 32ms RepoModel.GetById 0ms app.codeStats 0ms

/content/server/framework/atlassian-sdk/atlassian-plugin-xml-element-reference.md

https://bitbucket.org/zchristmas/atlassian-sdk-docs
Markdown | 259 lines | 223 code | 36 blank | 0 comment | 0 complexity | e99e65a92ca20e29d5d48d5db7771054 MD5 | raw file
Possible License(s): LGPL-2.0
  1. ---
  2. aliases:
  3. - /server/framework/atlassian-sdk/atlassian-plugin.xml-element-reference-16974521.html
  4. - /server/framework/atlassian-sdk/atlassian-plugin.xml-element-reference-16974521.md
  5. category: devguide
  6. confluence_id: 16974521
  7. dac_edit_link: https://developer.atlassian.com/pages/editpage.action?cjm=wozere&pageId=16974521
  8. dac_view_link: https://developer.atlassian.com/pages/viewpage.action?cjm=wozere&pageId=16974521
  9. date: '2017-12-08'
  10. legacy_title: atlassian-plugin.xml Element Reference
  11. platform: server
  12. product: atlassian-sdk
  13. subcategory: intro
  14. title: atlassian-plugin.xml element reference
  15. ---
  16. # atlassian-plugin.xml element reference
  17. The `atlassian-plugin.xml` file describes your plugin to Atlassian applications like JIRA or Confluence. For this reason, you'll often see this file referred to as the *descriptor*. This file describes important elements like your plugin component modules and visual resources that the Universal Plugin Manager (UPM) uses.  
  18. The following sections describe some of the basic elements in the descriptor XML file.
  19. The `atlassian-plugin` element
  20. This is the root element for your plugin descriptor. The plugin descriptor file should have this structure:
  21. ``` xml
  22. <atlassian-plugin key="com.atlassian.confluence.plugins.example" name="Example Plugin" plugins-version="2">
  23. <!-- ... -->
  24. </atlassian-plugin>
  25. ```
  26. <table>
  27. <colgroup>
  28. <col style="width: 20%" />
  29. <col style="width: 80%" />
  30. </colgroup>
  31. <thead>
  32. <tr class="header">
  33. <th><p>Attribute</p></th>
  34. <th><p>Description</p></th>
  35. </tr>
  36. </thead>
  37. <tbody>
  38. <tr class="odd">
  39. <td><p><code>key</code></p></td>
  40. <td><p>A String identifying the plugin module. This attribute is required and must be unique within the plugin. You should use the reverse domain name notation to ensure your key is unique. In other contexts, you may need to uniquely identify a module. You should use the complete module key.<br />
  41. <br />
  42. By default, the SDK generation commands sets the key for you by referencing and concatenating the <code>groupId</code> and <code>artifactId</code> from the <code>pom.xml</code>.</p></td>
  43. </tr>
  44. <tr class="even">
  45. <td><p><code>name</code></p></td>
  46. <td><p>This is a human-readable name, used for display in menus within the application. By default, the SDK generation commands sets the key for you by referencing the add-on <code>name</code> from the <code>pom.xml</code>. You should not use the words 'plugin' or 'add-on' in this value.</p></td>
  47. </tr>
  48. <tr class="odd">
  49. <td><p><code>state</code></p></td>
  50. <td><p>This is <code>enabled</code> by default. To disable the entire plugin, specify <code>disabled</code>.</p></td>
  51. </tr>
  52. <tr class="even">
  53. <td><p><code>plugins-version</code></p></td>
  54. <td><p>To create an OSGi plugin, use <code>plugins-version=&quot;2&quot;</code>.<br />
  55. NOTE: The attribute <code>pluginsVersion</code> was <strong>deprecated</strong> in version 2.1 of the plugin framework.</p></td>
  56. </tr>
  57. <tr class="odd">
  58. <td><p><code>i18n-name-key</code></p></td>
  59. <td><p>The localization key for the human-readable name of the plugin module.</p></td>
  60. </tr>
  61. <tr class="even">
  62. <td><p><code>class</code></p></td>
  63. <td><p>The class that implements this plugin module. The class you need to provide depends on the module type. For example, Confluence theme, layout and colour-scheme modules can use classes already provided in Confluence. So you can write a theme-plugin without any Java code. But for macro and listener modules you need to write your own implementing class and include it in your plugin.</p></td>
  64. </tr>
  65. <tr class="odd">
  66. <td><p><code>system</code></p></td>
  67. <td><p>Indicates whether this plugin module is a system plugin module (value='true') or not (value='false'). Only available for non-OSGi plugins.</p></td>
  68. </tr>
  69. </tbody>
  70. </table>
  71. ### The `plugin-info` element
  72. Contains plugin information displayed by the application for administrators, plugin parameters, and OSGi bundle instructions. Its parent element is `<atlassian-plugin>`, and it supports several nested elements.
  73. <table>
  74. <colgroup>
  75. <col style="width: 20%" />
  76. <col style="width: 80%" />
  77. </colgroup>
  78. <thead>
  79. <tr class="header">
  80. <th><p>Nested element</p></th>
  81. <th><p>Description</p></th>
  82. </tr>
  83. </thead>
  84. <tbody>
  85. <tr class="odd">
  86. <td><p><code>&lt;description&gt;</code></p></td>
  87. <td><p>A human-readable description of your plugin.</p></td>
  88. </tr>
  89. <tr class="even">
  90. <td><p><code>&lt;version&gt;</code></p></td>
  91. <td><p>The version of your plugin. This number is displayed in the application's plugin manager.</p></td>
  92. </tr>
  93. <tr class="odd">
  94. <td><p><code>&lt;java-version&gt;</code></p></td>
  95. <td><p>The Java version required for this plugin module. This is an optional value. It is not used consistently among the host applications.</p></td>
  96. </tr>
  97. <tr class="even">
  98. <td><p><code>&lt;vendor&gt;</code></p></td>
  99. <td><p>Supply information about the developer of the plugin.</p></td>
  100. </tr>
  101. <tr class="odd">
  102. <td><p><code>&lt;param&gt;</code></p></td>
  103. <td><p>Supply parameter values if required by your plugin.</p></td>
  104. </tr>
  105. <tr class="even">
  106. <td><p><code>&lt;bundle-instructions&gt;</code></p></td>
  107. <td><p>Declare plugin dependencies and shorten your export package lists by specifying OSGi bundle instructions directly in the plugin XML (OSGi plugins only).</p></td>
  108. </tr>
  109. </tbody>
  110. </table>
  111. These nested elements are described in more detail below.
  112. ### The `description` element
  113. Describes your plugin. Its parent element is `<plugin-info>`.
  114. ``` xml
  115. <atlassian-plugin ...>
  116. <plugin-info>
  117. <!-- ... -->
  118. <description>New macros for integration with Acme Corp. web services</description>
  119. </plugin-info>
  120. </atlassian-plugin>
  121. ```
  122. ### The `version` element
  123. The current version of your plugin. Its parent element is `<plugin-info>`. The UPM sometimes compares the plugin version value within an application to determine the newer version, particularly when performing automated upgrades. Versions are compared by splitting the version number into components and comparing them numerically first and alphabetically second.
  124. Following are some sample version numbers in ascending order: 0.99, 1.0, 1.0.1-alpha, 1.0.1-beta, 1.0.1-beta2, 1.0.1, 1.0.1.0, 1.1, 1.2, 1.10, 2.0.
  125. ``` xml
  126. <atlassian-plugin ...>
  127. <plugin-info>
  128. <!-- ... -->
  129. <version>1.2</version>
  130. </plugin-info>
  131. </atlassian-plugin>
  132. ```
  133. ### The `vendor` element
  134. The plugin vendor. Provides a link in the plugin administration screens. Its parent element is `<plugin-info>`.
  135. <table>
  136. <colgroup>
  137. <col style="width: 20%" />
  138. <col style="width: 80%" />
  139. </colgroup>
  140. <thead>
  141. <tr class="header">
  142. <th><p>Attribute name</p></th>
  143. <th><p>Description</p></th>
  144. </tr>
  145. </thead>
  146. <tbody>
  147. <tr class="odd">
  148. <td><p><code>name</code></p></td>
  149. <td><p>Supply your name or the name of the company you work for.</p></td>
  150. </tr>
  151. <tr class="even">
  152. <td><p><code>url</code></p></td>
  153. <td><p>Supply a web site address.</p></td>
  154. </tr>
  155. </tbody>
  156. </table>
  157. ``` xml
  158. <atlassian-plugin ...>
  159. <plugin-info>
  160. <!-- ... -->
  161. <vendor name="Acme Systems Ltd" url="http://acme.example.com/" />
  162. </plugin-info>
  163. </atlassian-plugin>
  164. ```
  165. ### The `param` element
  166. Arbitrary parameters for a plugin. Its parent element is `<plugin-info>`. These can be nested in many other elements. Attribute `name` gives the parameter name. The element's body is its value.
  167. <table>
  168. <colgroup>
  169. <col style="width: 20%" />
  170. <col style="width: 80%" />
  171. </colgroup>
  172. <thead>
  173. <tr class="header">
  174. <th><p>Attribute</p></th>
  175. <th><p>Description</p></th>
  176. </tr>
  177. </thead>
  178. <tbody>
  179. <tr class="odd">
  180. <td><p><code>name</code></p></td>
  181. <td><p>The name of the parameter.</p></td>
  182. </tr>
  183. <tr class="even">
  184. <td><p>(body)</p></td>
  185. <td><p>The value of the parameter.</p></td>
  186. </tr>
  187. </tbody>
  188. </table>
  189. A common example of a `param` element the URL for your plugin's configuration screen. Below is an example.
  190. ``` xml
  191. <atlassian-plugin ...>
  192. <plugin-info>
  193. <!-- ... -->
  194. <param name="configure.url">/admin/plugins/example/configurePlugin.action</param>
  195. </plugin-info>
  196. </atlassian-plugin>
  197. ```
  198. ### The `bundle-instructions` element
  199. **This element should not be used when using Spring Scanner transformerless plugins as it will be ignored. The preferred way to set OSGi instructions is the [`<instructions>` element in the `pom..xml`](https://developer.atlassian.com/server/framework/atlassian-sdk/managing-dependencies/#specifying-manifest-instructions).
  200. This element allows you to declare plugin dependencies and shorten your export package lists by specifying OSGi bundle instructions directly in the plugin XML. The list is used to generate the OSGi manifest. If you do not specify bundle instructions in the plugin descriptor or, alternatively, in the POM, the SDK generates one for you. 
  201. The element's parent element is `plugin-info`.
  202. ``` xml
  203. <atlassian-plugin ...>
  204. <plugin-info>
  205. <!-- ... -->
  206. <bundle-instructions>
  207. <Export-Package>my.external.pkg</Export-Package>
  208. <Import-Package>com.mylibrary,*;resolution:=optional</Import-Package>
  209. </bundle-instructions>
  210. </plugin-info>
  211. </atlassian-plugin>
  212. ```
  213. As seen in the above example, the `bundle-instructions` element allows child elements, including` Export-Package` and `Import-Package`. 
  214. ## Plugin module elements
  215. In the rest of the descriptor XML file, contains any modules that make up your plugin. You can add these modules through the `atlas-`\* commands or manually. The following illustrates the addition of a `web-item` module:
  216. ``` xml
  217. <web-item name="Radio Paradise" i18n-name-key="radio-paradise.name" key="radio-paradise" section="client-sites-link/my-section" weight="1000">
  218. <description key="radio-paradise.description">The Radio Paradise Plugin</description>
  219. <label key="radio-paradise.label"></label>
  220. <link linkId="radio-paradise-link">http://www.radioparadise.com</link>
  221. </web-item>
  222. ```
  223. For more information about the modules a plugin can contain, refer to the list of module types for your plugin's host application.