Version 13.1 by Thomas Mortagne on 2015/02/16

Hide last authors
Eduard Moraru 11.1 1 = How to contribute an extension on http://extensions.xwiki.org =
Caleb James DeLisle 1.1 2
Eduard Moraru 11.1 3 The current document will help you to create XAR extensions that will be installable via the extension manager. The extension manager is an application accessible from the [[XWiki Administration>>extensions:Extension.Administration Application]] that provides an UI to manage the extensions within a wiki. Extensions are mainly XARs (e.g. [[XWiki applications>>platform:Features.Applications]], [[wiki macros>>extensions:Extension.Wiki Macro Bridge Application]]). A XAR is a set of XWiki pages that represents an XWiki application, a macro or simply a page containing a code snippet. This document will explain how to publish a XAR automatically through the Extensions Manager (EM).
Caleb James DeLisle 1.1 4
Eduard Moraru 11.1 5 Notice that XARs (or JAR extensions) can also be imported from a maven repository (if they were previously released) and this process is [[documented on the contrib page>>contrib:Main.WebHome||anchor="HPublishingonextensions.xwiki.org"]].
Mohamed Boussaa 9.9 6
Eduard Moraru 11.1 7 == Step 1 ==
Thomas Mortagne 12.1 8
Caleb James DeLisle 1.1 9
Eduard Moraru 11.1 10 Go to [[http://extensions.xwiki.org>>extensions:Main.WebHome]] and login (you can [[create an account for the xwik.org community>>xwiki:XWiki.RealRegistration]] if you do not already have one).
Caleb James DeLisle 1.1 11
Eduard Moraru 11.1 12 Then type the name of the extension to create (e.g. ##TotemApplication##) into the **Contribute Extension** box and click **Add**.
Caleb James DeLisle 1.1 13
Thomas Mortagne 12.1 14 {{image reference="new-extension.png" width="800"/}}
Caleb James DeLisle 1.1 15
Eduard Moraru 11.1 16 == Step 2 ==
Caleb James DeLisle 1.1 17
Eduard Moraru 11.1 18 After clicking the **Add** button you will be redirected to the edit form of your new extension.
Caleb James DeLisle 1.1 19
Eduard Moraru 11.1 20 In the **Source** field, you can put the URL of the GitHub repository containing your application's code.
21 **Description/license/summary** are whatever you want, we're creating an extension which can be installed with the ExtensionManager so **Custom Installation** and **Custom Installation Instructions** should remain blank/unchecked.
Caleb James DeLisle 1.1 22
Thomas Mortagne 12.1 23 {{image reference="extension-info.png" width="800"/}}
Eduard Moraru 11.1 24
25 Once you've done that, just save the TotemApplication page (Save & View).
26
27 == Step 3 ==
28
Caleb James DeLisle 1.1 29 Add the .xar file as an attachment to your extension document.
30
Eduard Moraru 11.1 31 == Step 4 ==
Caleb James DeLisle 1.1 32
Eduard Moraru 11.1 33 So after you've finished uploading the .xar file, click **Edit** on the page and then scroll down almost to the bottom where you'll find the **Add Downloads** section. There, you need to read the instructions on the second bullet (the one starting with "Add Download information") and click on **Extension Version**.
Caleb James DeLisle 1.1 34
Thomas Mortagne 12.1 35 {{image reference="add-down-info.png" width="800"/}}
Caleb James DeLisle 1.1 36
Eduard Moraru 11.1 37 Now you should be back at the edit page with a **Current Downloads** section added.
Caleb James DeLisle 1.1 38
Thomas Mortagne 12.1 39 {{image reference="current-down.png" width="800"/}}
Caleb James DeLisle 1.1 40
Eduard Moraru 11.1 41 With **Release notes**, **Download URL**, **id** and **Version**.
Caleb James DeLisle 1.1 42
Eduard Moraru 11.1 43 ; Download URL
44 : should be {{{attach:<the name of your attachment>}}}, for example {{{attach:totem-1.0.xar}}}.
45 ; id
Thomas Mortagne 13.1 46 : this field is optional and mostly used by the importer so you can leave it blank. If you really want to put something put the same ID as the one used by your application, ex: ##mouhb:totemapplication##. If you do not know how to get the ID of an application, have a quick look at step 6 for the details.
Eduard Moraru 11.1 47 ; Version
48 : is whatever the version number is, for example ##1.0##.
Caleb James DeLisle 1.1 49
Eduard Moraru 11.1 50 Make sure to use only <major>.<minor> in the version number, a version number such as ##1.0.0## or ##1.0-feb13## will cause problems.
Caleb James DeLisle 1.1 51
Eduard Moraru 11.1 52 Save the extension page (Save & View).
Caleb James DeLisle 1.1 53
Eduard Moraru 11.1 54 == Step 5 ==
Caleb James DeLisle 1.1 55
Eduard Moraru 11.1 56 When you go back to the extension page, you should now see a label saying "Installable with Extension Manager".
Caleb James DeLisle 1.1 57
Thomas Mortagne 12.1 58 {{image reference="installable-with-extension-manager.png" width="800"/}}
Eduard Moraru 11.1 59
60 If there is no "Installable with Extension Manager" mentioned, then there is a problem. You have to go back to the edit page and check the extension information as mentioned above in this document.
61
62 == Step 6 ==
63
Caleb James DeLisle 1.1 64 {{info}}
Eduard Moraru 11.1 65 Skip this step if your extension does not depend on other extensions.
Caleb James DeLisle 1.1 66 {{/info}}
67
Eduard Moraru 11.1 68 In our example, the extension depends on the [[Multiselect custom display>>extensions:Extension.Multiselect custom display]] extension.
Caleb James DeLisle 1.1 69 We need the ID of the dependency extension (In our example : **org.xwiki.contrib:displayer-multiselect-suggest**).
70
Eduard Moraru 11.1 71 To get the ID of the dependency extension, you need to edit the extension in edit object mode.
Caleb James DeLisle 1.1 72 Click Edit on extension page and append **?editor=object** to the URL in order to be switched into Object Edit mode.
Eduard Moraru 11.1 73 In our example the URL is the following: http://extensions.xwiki.org/xwiki/bin/edit/Extension/Multiselect+custom+display?editor=object
Caleb James DeLisle 1.1 74
Eduard Moraru 11.1 75 Note: alternatively, you can reach the object editor by setting your user profile preferences **User Type** value to ##Advanced##. Once you do that, the **Edit** button on the page can be expanded and the **Objects** option can be selected.
Caleb James DeLisle 1.1 76
Eduard Moraru 11.1 77 Now expand the first entry in **Objects of type ExtensionCode.ExtensionClass (1)** and select **Id** which is the first property in that object (the value is ##org.xwiki.contrib:displayer-multiselect-suggest##). Copy that value to the clipbloard (CTRL+C) since we need it further along.
78 Click cancel or close the tab ({{warning}}DON'T CLICK SAVE{{/warning}}).
Mohamed Boussaa 9.2 79
Thomas Mortagne 12.1 80 {{image reference="extension-id.png" width="800"/}}
Caleb James DeLisle 1.1 81
Eduard Moraru 11.1 82 When you got the ID, go back to your extension edit page to declare the dependency.
83 Scroll down down almost to the bottom where you'll find the **Add Dependencies** section. There, you need to read the instructions and click on **Dependency**.
Caleb James DeLisle 1.1 84
Thomas Mortagne 12.1 85 {{image reference="add-new-dep.png" width="800"/}}
Caleb James DeLisle 1.1 86
Eduard Moraru 11.1 87 Now you should be back at the edit page with a "Current Dependencies" section added which you can edit. See the picture above for details on what each field means.
Caleb James DeLisle 1.1 88
Eduard Moraru 11.1 89 When done editing the dependency, save the extension page (Save & View).
Caleb James DeLisle 1.1 90
Thomas Mortagne 12.1 91 {{image reference="current-dep.png" width="800"/}}
Caleb James DeLisle 1.1 92
Eduard Moraru 11.1 93 To check if the dependency was added successfully, go back to the main page and check that the "Installable with the Extension Manager" tag still exists.
94 Extensions.xwiki.org will automatically remove it if something is broken with the extension after adding a dependency.
Caleb James DeLisle 1.1 95
Eduard Moraru 11.1 96 == Step 7 ==
Caleb James DeLisle 1.1 97
Eduard Moraru 11.1 98 The last step is to start up a fresh wiki on your machine, go to **Administer Wiki**, click **Install Extensions** on the left and type the name of your extension, in our example ##totem##.
Caleb James DeLisle 1.1 99
Eduard Moraru 11.1 100 Once you verify that the extension was successfully installed (and works) on your local wiki, then the process of creating the extension is complete.
Caleb James DeLisle 1.1 101
Thomas Mortagne 12.1 102 {{image reference="install-extension.png" width="800"/}}

Get Connected