Wiki source code of XWiki Contrib

Version 76.1 by Vincent Massol on 2015/12/14 12:01

Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 **XWiki Contrib** is a community dedicated to collaborative development of XWiki related projects and extensions in the spirit of wiki communities. These projects are not part of the official XWiki distributions and are not maintained by the XWiki development team.
6
7 = Contrib Project List =
8
9 The full list of Contrib projects is available [[here>>Main.ProjectList]].
10
11 = Hosting tools =
12
13 The project hosting forge can provide contributors with some or all of the following tools:
14
15 * A **GitHub repository**, under http://github.com/xwiki-contrib
16 * A **JIRA project** for tracking bugs and feature requests, at http://jira.xwiki.org/ and under the "XWiki Contributed projects" category. Note that each project should have its own JIRA project (we used to have a single generic JIRA project with different ##components## but this was creating difficulties).
17 * A generic **maven groupId**: ##org.xwiki.contrib## (or ##org.xwiki.contrib.<module name>## if the project has several modules). That's until the project reaches a certain size and visibility, in which case it can have its own maven group id.
18 * A **Mailing list** for your project. Note that for the moment, all the projects share [[common mailing list>>dev:Community.MailingLists]].
19 * **Project pages** on [[extensions.xwiki.org>>extensions:Main.WebHome]] to describe and document the project. When the project reaches a certain visibility and size it can have its own wiki on xwiki.org.
20 * A **CI job** on http://ci.xwiki.org for building the project automatically on each commit.
21 * A **Sonar project report** on http://sonar.xwiki.org to analyze the project's quality with various metrics.
22
23 = Contributing to an existing project =
24
25 If you're interested to contribute to an existing project on http://github.com/xwiki-contrib, please send an email to **##devs AT xwiki.org##** (after having [[subscribed>>dev:Community.MailingLists]]), introducing yourself and explaining what you wish to do. Make sure to create an account on GitHub and mention this id in the email so that we can give you access. Thanks for helping out! :)
26
27 = Why join XWiki Contrib =
28
29 You could very well develop your XWiki extension in your own GitHub organization and you might wonder why put your project on XWiki Contrib. Some reasons:
30
31 * You join a Community, the XWiki open source community. We value a lot the community notion and we want to be more like the Apache Software Foundation (strong sense of community) rather than Source Forge (list of independent projects, little community). In particular, this is why we ask you to introduce yourself when requesting a project.
32 * This makes your extension visible to the XWiki community and thus other contributors may want to join you in participating to the development of your extension (contribute on code, discussions, promotion, etc).
33 * You get some tools setup for your project (GitHub repository, Issue tracker, Wiki pages)
34
35 = Requesting a project =
36
37 The contrib project is open for anyone who wish to start a new project. Simply send us an email at **##devs AT xwiki.org##** using "**[Contrib]**" at the beginning of your email's subject (after having [[subscribed>>dev:Community.MailingLists]]). Let us know the name and a short description of the project. If your project has already been made available for download on extensions.xwiki.org, please mention it and point us to its page (If it is not, then no need to hurry, you will make it available once it's ready). Finally, let us know which of the tools listed above you need. For GitHub access, you will need to register a user on http://github.com and let us know about it (a best practice is to have a username composed of the first letter of your first name immediately followed by your last name, the whole with no capital letter, for example **jdoe** if your name is John Doe).
38
39 When picking the GitHub name please follow the existing conventions:
40
41 * ##application-<xxx>## for apps
42 * ##macro-<xxx>## for macros only (if you project provides a macro but also provides other wiki pages then it's considered an app)
43 * ##api-<xxx>## for APIs only (same as for macro, if it contains UI as well, then you should call it an app instead)
44 * ##displayer-<xxx>## for custom displayers
45
46 For the actual project name part (##<xxx>## of the git repository name) it is preferred to use a single word (e.g. ##application-forum##). However, sometimes that is not descriptive enough, so you can either use multiple words next to each other (e.g. ##application-filemanager##) if that makes sense and looks natural enough or, if not, you should separate the words with a dash (e.g. ##displayer-multiselect-suggest##). Whatever you decide, please try to keep it as short and descriptive as possible.
47
48 //Hint//: When in doubt, have a look at [[existing repository names>>https://github.com/xwiki-contrib]] for inspiration.
49
50 = Requesting snapshot builds for your project =
51
52 XWiki.org has a [[continuous build>>http://dev.xwiki.org/xwiki/bin/view/Community/ContinuousBuild]] which builds maven projects each time they are modified on GitHub and put the resulting artifact in our [[snapshots repository>>http://maven.xwiki.org/snapshots/]]. This is useful when you want people using your project as a dependency to continuously benefit from the improvements or to tell users of your Extension try it out before it's released.
53
54 Your can ask for your project to be added to the continuous build by sending a mail to the devs list:
55
56 * First you need to use the XWiki parent pom to have the correct distribution management information:(((
57 {{code language="xml"}}
58 <project>
59 ...
60 <parent>
61 <groupId>org.xwiki.commons</groupId>
62 <artifactId>xwiki-commons-pom</artifactId>
63 <version>see the building section below to choose the version</version>
64 </parent>
65 ...
66 </project>
67 {{/code}}
68 )))
69 * [[Send a mail on the [email protected] mailing list>>dev:Community.MailingLists]] to ask for the addition of your project to the continuous build. Example mail:(((
70 {{code language="none"}}
71 [Contrib] Add <myproject> to the CI
72
73 Hi XWikiers,
74
75 I'm working on <myproject> and I'd like to have it built by XWiki.org's CI. Could it be added?
76
77 Thanks,
78 <your name>
79 {{/code}}
80 )))
81
82 = Release the project =
83
84 XWiki.org allows you to release your project on the [[XWiki Maven Remote Repository>>http://nexus.xwiki.org]] as long as you follow these steps:
85
86 * Use ##org.xwiki.contrib## as ##groupId## in your maven module
87 * Request for an account on [[Nexus>>http://nexus.xwiki.org]] by sending a mail to the [[Developer's list>>dev:Community.MailingLists]] mentioning the username you'd wish to have (you could also mention which extension you're planning to release to provide contextual information).
88 * Once you've received your credentials put them in ##~~/.m2/settings.xml##(((
89 {{code language="xml"}}
90 <settings>
91 ...
92 <servers>
93 ...
94 <server>
95 <id>xwiki-staging</id>
96 <username>username</username>
97 <password>********</password>
98 </server>
99 ...
100 </servers>
101 ...
102 </settings>
103 {{/code}}
104 )))
105 * Put the following configuration in your project ##pom.xml##(((
106 {{code language="xml"}}
107 <project>
108 ...
109 <scm>
110 <connection>scm:git:git://github.com/xwiki-contrib/{extensionrepository}.git</connection>
111 <developerConnection>scm:git:[email protected]:xwiki-contrib/{extensionrepository}.git</developerConnection>
112 <url>https://github.com/xwiki-contrib/{extensionrepository}</url>
113 </scm>
114 ...
115 <distributionManagement>
116 <repository>
117 <id>xwiki-staging</id>
118 <name>XWiki Staging Repository</name>
119 <url>http://nexus.xwiki.org/nexus/service/local/staging/deploy/maven2/</url>
120 </repository>
121 </distributionManagement>
122 ...
123 </project>
124 {{/code}}
125
126 Where ##{extensionrepository}## is the name of the repository in http://github.com/xwiki-contrib/.
127 )))
128 * Release the project with the maven release plugin(((
129 {{code language="none"}}
130 mvn org.apache.maven.plugins:maven-release-plugin:2.5:prepare
131 {{/code}}
132
133 {{info}}
134 In case you're wondering why we force using this Maven Release plugin version, it's because versions < 2.5 of this plugin have a bug when using Git 1.9+ which leads to not resolving properly SNAPSHOT versions when tagging.
135 {{/info}}
136
137 {{error}}
138 If you are releasing from ##Microsoft Windows## and inherit from standard ##XWiki Commons root pom## < 6.2 you might have issues performing the release (see http://jira.xwiki.org/browse/XCOMMONS-553 for details). The workaround is to skip the enforcer plugin:
139
140 {{code language="none"}}
141 mvn release:perform -Darguments="-Dxwiki.enforcer.skip=true"
142 {{/code}}
143 {{/error}}
144
145 {{warning}}
146 If the application has also tests and you want to release the modules, but not run the tests, you should:
147
148 {{code language="none"}}
149 mvn org.apache.maven.plugins:maven-release-plugin:2.5:prepare -Pintegration-tests -Darguments="-DskipTests" -DskipTests
150 {{/code}}
151
152 If you want to skip the enforcer plugin, use:
153
154 {{code language="none"}}
155 mvn org.apache.maven.plugins:maven-release-plugin:2.5:prepare -Pintegration-tests -Darguments="-DskipTests -Dxwiki.enforcer.skip=true" -DskipTests
156 {{/code}}
157
158 {{/warning}}
159 )))
160 * The released XWiki artifacts are signed ([[http:~~/~~/en.wikipedia.org/wiki/Digital_signature>>http://en.wikipedia.org/wiki/Digital_signature]]). This helps downloaders check that indeed the binary is what was initially put in there, and was not replaced by an intruder.(((
161 The signing maven plugin is configured in the toplevel pom ( {{code}}<groupId>org.xwiki.commons</groupId><artifactId>xwiki-commons</artifactId>{{/code}} ) so any module that's inheriting from that will have the gpg plugin configured by default. To find out, get the effective pom of your module ( {{code}}mvn help:effective-pom{{/code}} ) and check if the gpg maven plugin is there (maven-gpg-plugin).
162
163 If you're gonna try to release like that, it will probably fail since the gpg plugin expects you to have a gnupg key with a password. You now have 2 options:
164
165 * Overwrite the settings of the gpg plugin in your pom to disable signing:(((
166 {{code}}
167 <profiles>
168 <profile>
169 <id>release</id>
170 <build>
171 <plugins>
172 <plugin>
173 <groupId>org.apache.maven.plugins</groupId>
174 <artifactId>maven-gpg-plugin</artifactId>
175 <configuration>
176 <skip>true</skip>
177 </configuration>
178 </plugin>
179 </plugins>
180 </build>
181 </profile>
182 </profiles>
183 {{/code}}
184 )))
185 * Configure your setup to sign properly. To do that, you will have to:
186 ** generate a gpg key which will be stored in your home folder and will be used by maven. On linux you can do that using the default gpg command ({{code}}gpg --gen-key{{/code}}, read the man page if you want to know more about the options). On Windows you can use [[Gpg4win>>http://www.gpg4win.org/]], while on Mac you have the [[GPG Suite>>https://gpgtools.org/]]. If you don't know what to fill in for the options requested by the tool, keep the defaults.
187 ** Tell maven the passphrase of this key (the one you entered upon key generation), either in the command line when performing the release {{code}}mvn release:perform -Darguments=-Dgpg.passphrase=PASSWORD{{/code}} or set it in your maven settings.xml like this(((
188 {{code}}
189 ...
190 <profile>
191 <id>xwiki</id>
192 <properties>
193 <gpg.passphrase>PASSWORD</gpg.passphrase>
194 </properties>
195 ...
196 {{/code}}
197 )))
198 )))
199 * You're done now, you can go on releasing(((
200 {{code language="none"}}
201 mvn org.apache.maven.plugins:maven-release-plugin:2.5:perform
202 {{/code}}
203
204 {{info}}
205 On Windows you can use this command to successfully perform the release:
206
207 {{code language="none"}}
208 mvn org.apache.maven.plugins:maven-release-plugin:2.5:perform -Darguments="-Dgpg.passphrase="YourGpg4winPassword" -Dxwiki.enforcer.skip=true"
209 {{/code}}
210
211 but be careful to replace "YourGpg4winPassword" with the actual password chosen when creating a GPG key with [[Gpg4win>>http://www.gpg4win.org/]].
212
213 {{/info}}
214
215 {{info}}
216 In case you're wondering why we force using this Maven Release plugin version, it's because versions < 2.5 of this plugin have a bug when using Git 1.9+ which leads to not resolving properly SNAPSHOT versions when tagging.
217 {{/info}}
218
219 {{warning}}
220 If the application has also tests and you want to release the modules, but not run the tests, you should:
221
222 {{code language="none"}}
223 mvn org.apache.maven.plugins:maven-release-plugin:2.5:perform -Pintegration-tests -Darguments="-DskipTests -Pintegration-tests" -DskipTests
224 {{/code}}
225
226 {{/warning}}
227 )))
228 * Note that you'll need to push the changes done by the release plugin: {{code}}git push origin master{{/code}}
229 * Ask for someone (on the devs mailing list or on IRC) to validate your release from the staging repository on [[Nexus>>http://nexus.xwiki.org]] to make your extension available on maven.xwiki.org. Alternatively if you've been granted the permissions you can do this yourself by understanding [[Nexus Staging>>http://books.sonatype.com/nexus-book/reference/staging-repositories.html]]. To perform promotion do the following:
230 ** Select the repository to validate in the Staging Repositories list
231 ** Click the "Close" button to close it. Wait a few seconds since it's done asynchronously.
232 ** Make sure to test your extension from the closed staging repo first since a released repo cannot be removed!
233 ** Once you want to move your extension from the Staging Repository to the Public Repository click the "Release" button. Wait a few seconds since it's done asynchronously.
234 * After that your release will be available for download on maven.xwiki.org and anyone will be able to use it as a dependency for his own project
235 * If your project is using JIRA, release the version in JIRA and add a new version label for the next version.
236 * Update the documentation for your project (or create it if there's none) on the [[Extensions Wiki>>extensions:Main.WebHome]] and make sure to add release notes information. See the next section for more.
237
238 = Recovering from a failed Release =
239
240 It may happen that the ##release:perform## fails. In this case you'll want to rollback, fix the problem and release again. Maven generates temporary files in your module's directory. Don't remove them! :)
241
242 To rollback you need to call the following:
243
244 {{code language="none"}}
245 mvn org.apache.maven.plugins:maven-release-plugin:2.5:rollback
246 {{/code}}
247
248 {{warning}}
249 The document for the [[##release:rollback## mojo>>http://maven.apache.org/maven-release/maven-release-plugin/examples/rollback-release.html]] says that currently the deletion of the created tag is not implemented. Thus even if you se the rollback call you may still need to perform step 2 of the manual process below.
250 {{/warning}}
251
252 Now if you have already deleted those files, don't panic! It's still easy to recover. You'll just need to do manually [[what the ##release:rollback## does>>http://maven.apache.org/maven-release/maven-release-plugin/examples/rollback-release.html]]:
253 * Rollback the changes done by the ##release:prepare## call by reverting the changes in Git
254 * Remove the local and remote tag created by the ##release:prepare## call ({{code language="none"}}git branch -d the_local_tag{{/code}} and {{code language="none"}}git push origin :the_remote_tag{{/code}}).
255
256 = Publishing on extensions.xwiki.org =
257
258 The first step is to [[release>>||anchor="HReleasetheproject"]] your extension in the XWiki Maven Remote Repository. Then go the [[Extension wiki home page>>extensions:Main.WebHome]] and click on the [[Import>>extensions:ExtensionCode.ImportExtension]] button located inside the Contribute box (you'll need to be logged in). Then fill in your extension id (the format is ##<maven groupId>:<maven artifactId>##), select the ##maven-xwiki## repository and press the import button.
259
260 If you have already created an extension page manually on extensions.xwiki.org, the import will locate it (provided you've filled the correct extension id in your extension page, you can edit it in Object mode to fill it if that's not the case) and will overwrite data that it finds in your extension's ##pom.xml## file, preserving the rest of the information you've manually entered (like the description).
261
262 = Implementing your Maven build =
263
264 {{info}}
265 You can find [[reference documentation for the XAR Plugin>>dev:Community.XARPlugin]].
266 {{/info}}
267
268 Here's an example of how your ##pom.xml## should look like (adapt to your need) if you're contributing an application (XAR):
269
270 {{code language="xml"}}
271 <?xml version="1.0" encoding="UTF-8"?>
272
273 <!--
274 *
275 * See the NOTICE file distributed with this work for additional
276 * information regarding copyright ownership.
277 *
278 * This is free software; you can redistribute it and/or modify it
279 * under the terms of the GNU Lesser General Public License as
280 * published by the Free Software Foundation; either version 2.1 of
281 * the License, or (at your option) any later version.
282 *
283 * This software is distributed in the hope that it will be useful,
284 * but WITHOUT ANY WARRANTY; without even the implied warranty of
285 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
286 * Lesser General Public License for more details.
287 *
288 * You should have received a copy of the GNU Lesser General Public
289 * License along with this software; if not, write to the Free
290 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
291 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
292 *
293 -->
294
295 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
296 <modelVersion>4.0.0</modelVersion>
297 <parent>
298 <groupId>org.xwiki.commons</groupId>
299 <artifactId>xwiki-commons-pom</artifactId>
300 <version>4.5</version>
301 </parent>
302 <groupId>org.xwiki.contrib</groupId>
303 <artifactId>your-extension-id</artifactId>
304 <version>1.0-SNAPSHOT</version>
305 <name>Your extension's name</name>
306 <packaging>xar</packaging>
307 <description>Your extension's description</description>
308 <scm>
309 <connection>scm:git:git://github.com/xwiki-contrib/(your extension id).git</connection>
310 <developerConnection>scm:git:[email protected]:xwiki-contrib/(your extension id).git</developerConnection>
311 <url>https://github.com/xwiki-contrib/(your extension id)</url>
312 </scm>
313 <developers>
314 <developer>
315 <id>scm id of developer 1</id>
316 <name>Full Name of developer 1 as registered on xwiki.org, e.g. Vincent Massol</name>
317 </developer>
318 ...
319 <developer>
320 <id>scm id of developer N</id>
321 <name>Full Name of developer N as registered on xwiki.org, e.g. Vincent Massol</name>
322 </developer>
323 </developers>
324 <properties>
325 <!-- Don't run CLIRR here since there's no Java code. -->
326 <xwiki.clirr.skip>true</xwiki.clirr.skip>
327 <!-- The Extension name. If not defined, the <name> property is used -->
328 <xwiki.extension.name>Your extension's name</xwiki.extension.name>
329 <!-- The extension's category -->
330 <xwiki.extension.category>application</xwiki.extension.category>
331 </properties>
332 <build>
333 <!-- Needed to add support for the XAR packaging -->
334 <extensions>
335 <extension>
336 <groupId>org.xwiki.commons</groupId>
337 <artifactId>xwiki-commons-tool-xar-handlers</artifactId>
338 <version>${commons.version}</version>
339 </extension>
340 </extensions>
341 <plugins>
342 <!-- The XAR packaging uses the XAR plugin and thus we need to define what version to use -->
343 <plugin>
344 <groupId>org.xwiki.commons</groupId>
345 <artifactId>xwiki-commons-tool-xar-plugin</artifactId>
346 <version>${commons.version}</version>
347 </plugin>
348 </plugins>
349 </build>
350 <distributionManagement>
351 <repository>
352 <id>xwiki-staging</id>
353 <name>XWiki Staging Repository</name>
354 <url>http://nexus.xwiki.org/nexus/service/local/staging/deploy/maven2/</url>
355 </repository>
356 </distributionManagement>
357 </project>
358 {{/code}}
359
360 It's very important that you set the following information as they'll be used when you publish your extension on [[extensions.xwiki.org>>extensions:Main.WebHome]]:
361
362 * Extension id
363 * Name
364 * Description
365 * Developers
366 * {{info}}New{{/info}} Category (using ##<xwiki.extension.category>##). Valid values are [[listed here>>extensions:Extension.Repository Application#HCategories]].
367
368 You'll also need to set the SCM information since using the Maven Release plugin will require those to be set.
369
370 If you've modified the ##groupId## or ##artifactId## of the extension you need to tell it to the Extension Manager so that it can handle upgrades and understand it's the same extension being upgraded. For example if the extension previously had an extension id of ##tdelafosse:meeting-application## and you're now using another id, you need to add the following property to your ##pom.xml##:
371
372 {{code language="xml"}}
373 <properties>
374 ...
375 <!-- Old names of this module used for retro compatibility when resolving dependencies of old extensions -->
376 <xwiki.extension.features>tdelafosse:meeting-application</xwiki.extension.features>
377 ...
378 </properties>
379 {{/code}}
380
381 {{info}}
382 In addition you need to pay attention to the version of the dependencies you're going to use (for example the parent POM dependency to ##org.xwiki.commons:xwiki-commons-pom##). If you wish your extension to be used by the maximum number of XWiki users you need to use the oldest dependencies version for which you extension still works. This is because your extension will only be able to be installed in XWiki versions satisfying those dependencies you expressed.
383 {{/info}}
384
385 = Application Design =
386
387 This section provides suggested best practices for writing an application. It is there to ensure your application is nice and easy to use by XWiki users.
388
389 * Put all your pages in a space dedicated for your application. This makes your application nicely compartmented. Pick a short space name (e.g. ##UserDirectory##). Examples of space names:(((
390 {{image reference="spaces.png"/}}
391 )))
392 * Ensure that all technical pages of your application are marked as ##hidden## so that users don't see them by default. To do so, edit those pages and tick the ##hidden## checkbox(((
393 {{image reference="hidden.png"/}}
394 )))
395 * Make sure you add a User Interface Extension (UIX) for the Application Panel extension point. This registers your application into the Application Panel:(((
396 {{image reference="applications-panel.png"/}}
397
398 This is done by adding an object of type ##XWiki.UIExtensionClass## in a page in your application space. We recommend having a page named ##<your space>.ApplicationsPanelEntry## (e.g. ##Blog.ApplicationPanelEntry##). For example:
399 {{image reference="application-uix.png"/}}
400
401 In order to have a nice-looking UIX page, We also recommend to have the following content on that page (insert it in wiki edit mode):
402
403 {{code}}
404 {{include document="XWiki.UIExtensionSheet" /}}
405 {{/code}}
406 )))
407
408 = Documenting =
409
410 After you've published your extension in the XWiki Maven Remote Repository, import it on [[extensions.xwiki.org>>extensions:Main.WebHome]] (click on "Import" on that page, you'll need to be logged in after registering yourself). This creates an extension page. Verify that your extension is marked as "Installable with the Extension Manager". This makes it easy for users to install it from within their XWiki instances.
411
412 {{warning}}
413 If you've already created the page on [[extensions.xwiki.org>>extensions:Main.WebHome]] prior to importing the extension then make sure you've used the correct extension id on your extension page as otherwise the import will not be able to import your extension data on the right page and instead it'll create another page and you'll find yourself with 2 pages...
414 {{/warning}}
415
416 Verify the value of the fields filled automatically by the import, namely:
417
418 * The page name
419 * The description
420 * The authors
421
422 If they're wrong you'll need to publish a new version of your extension and re-import it.
423
424 Edit it and provide nice user-friendly documentation. We recommend the following elements to be present:
425
426 * Description of what the extension does and the features it has (briefly). Provides an overview screenshot if it makes sense.
427 * Usage: explains how to use it
428 * Document each feature with some text but very importantly with a screenshot
429 * Fill the "General Compatibility" section with the minimal version of XWiki your extension requires to be installed
430 * Fill the "Tested On" section with the versions of XWiki you've tested your extension on. Never remove any existing data from this section since they represent past tests and we need to keep the history.
431
432 Make sure to follow the [[Documentation guide>>dev:Community.DocGuide]]. For example take a special care to follow the [[Image best practices>>dev:Community.DocGuide#HScreenshots2FImages]] (use the {{{{{image}}}}} macro and don't take large screenshots as mentioned).
433
434 Make sure that you add documentation for your extension as soon as it's published on [[extensions.xwiki.org>>extensions:Main.WebHome]]. Otherwise nobody is going to start using it and people will start wondering what it's about.
435
436 Generally speaking check out documentation of existing extensions and try to mimic what you see (don't hesitate to go beyond the quality of what you see; you want your extension to be the most used, right? :) Documentation goes a long way towards achieving this!).

Get Connected