Permalink
Fetching contributors…
Cannot retrieve contributors at this time
494 lines (440 sloc) 19.3 KB
title review labels toc confluence tree_item_index history
Creating Nuxeo Packages
comment date status
2017-12-12
ok
lts2016-ok
marketplace
packaging-component
ataillefer
lts2017-ok
true
ajs-parent-page-id ajs-parent-page-title ajs-space-key ajs-space-name canonical canonical_source page_id shortlink shortlink_source source_link
16089349
Nuxeo Add-Ons
NXDOC
Nuxeo Platform Developer Documentation
Creating+Nuxeo+Packages
3342859
CwIz
/display/NXDOC/Creating+Nuxeo+Packages
200
author date message version
Arnaud Kervern
2016-08-16 09:45
54
author date message version
Manon Lumeau
2016-06-09 13:54
53
author date message version
Alain Escaffre
2016-03-23 15:53
52
author date message version
Julien Carsique
2016-01-15 10:26
51
author date message version
Ronan Daniellou
2016-01-15 10:13
Typo 'you package' -> your
50
author date message version
Solen Guitter
2015-11-30 08:58
49
author date message version
Manon Lumeau
2015-10-14 12:36
48
author date message version
Julien Carsique
2015-10-13 17:02
47
author date message version
Julien Carsique
2015-10-13 16:57
46
author date message version
Julien Carsique
2015-10-13 14:25
45
author date message version
Julien Carsique
2015-09-28 14:26
44
author date message version
Julien Carsique
2015-09-28 14:25
43
author date message version
Solen Guitter
2015-01-30 14:07
42
author date message version
Bertrand Chauvin
2014-11-14 14:59
41
author date message version
Bertrand Chauvin
2014-11-14 14:59
40
author date message version
Bertrand Chauvin
2014-11-14 14:58
39
author date message version
Bertrand Chauvin
2014-11-14 14:56
38
author date message version
Bertrand Chauvin
2014-11-14 14:55
Added link to NX IDE wizard page
37
author date message version
Solen Guitter
2014-09-23 11:13
36
author date message version
Manon Lumeau
2014-09-15 10:48
35
author date message version
Julien Carsique
2014-09-12 15:26
NXDOC-122: use configuration template instead of form
34
author date message version
Julien Carsique
2014-09-12 15:21
NXDOC-380: JIRA macro is broken
33
author date message version
Julien Carsique
2014-09-12 15:14
32
author date message version
Julien Carsique
2014-09-12 15:13
NXDOC-122: ParametrizedCopy
31
author date message version
Solen Guitter
2013-09-20 15:12
Added TOC
30
author date message version
Alain Escaffre
2013-09-17 00:05
29
author date message version
Alain Escaffre
2013-09-17 00:05
28
author date message version
Solen Guitter
2011-11-14 15:28
Migrated to Confluence 4.0
27
author date message version
Solen Guitter
2011-11-14 15:28
replaced 5.4.3 with 5.5
26
author date message version
Julien Carsique
2011-08-16 19:02
NXP-6139 - add the templates folder as an env variable to the Update Center installer framework
25
author date message version
whajeri
2010-11-15 11:18
24
author date message version
whajeri
2010-11-15 11:17
23
author date message version
Stéfane Fermigier
2010-10-06 08:26
22
author date message version
Stéfane Fermigier
2010-10-06 08:24
21
author date message version
Eric Barroca
2010-08-16 17:20
20
author date message version
Jane Zupan
2010-08-12 00:42
19
author date message version
Alain Escaffre
2010-08-10 02:53
18
author date message version
Bogdan Stefanescu
2010-07-07 17:18
17
author date message version
Bogdan Stefanescu
2010-07-07 16:35
16
author date message version
Bogdan Stefanescu
2010-07-07 16:30
15
author date message version
Bogdan Stefanescu
2010-07-07 16:25
14
author date message version
Bogdan Stefanescu
2010-07-07 15:45
13
author date message version
Bogdan Stefanescu
2010-07-07 14:49
12
author date message version
Bogdan Stefanescu
2010-07-07 12:41
11
author date message version
Bogdan Stefanescu
2010-07-07 12:32
10
author date message version
Bogdan Stefanescu
2010-07-07 12:19
9
author date message version
Bogdan Stefanescu
2010-07-07 11:58
8
author date message version
Bogdan Stefanescu
2010-07-07 11:57
7
author date message version
Bogdan Stefanescu
2010-07-07 11:51
6
author date message version
Bogdan Stefanescu
2010-07-07 11:38
5
author date message version
Bogdan Stefanescu
2010-07-07 11:24
4
author date message version
Bogdan Stefanescu
2010-07-07 11:19
3
author date message version
Bogdan Stefanescu
2010-07-07 10:55
2
author date message version
Bogdan Stefanescu
2010-07-07 10:39
1

{{! excerpt}}

This section gives instructions on how to wrap a plugin and its required dependencies into a Nuxeo Package.

{{! /excerpt}}

A Nuxeo Package usually contains new features or patches along with installation instructions and optional constraints towards other packages (dependency, conflict). It is the easiest way to distribute a plugin, as it contains in one single ZIP file all the bundles, libraries, configuration properties and templates that are required to make the plugin work. Moreover, it is the most reliable and sustainable way to install a plugin, as it provides install history, rollback capabilities, dependencies and conflicts resolution and much more. Nuxeo uses the Nuxeo Package format for distributing all its plugins on the Nuxeo Marketplace. Nuxeo Packages are also recommended for delivering your customization.

The Nuxeo Packages can be managed either in the Admin page on the Nuxeo server, or using [the nuxeoctl program]({{page page='nuxeoctl-and-control-panel-usage'}}).

Each package contains a description of the modifications that should be done on the server in order to install a plugin. We call "command" each atomic instruction of an install or uninstall process. The commands are revertible: for any command execution there is an inverse command that can be executed to rollback the modifications. While installing a package, Nuxeo generates the uninstall instructions (rollback commands) which will be executed either when the installation fails (in the middle of the install process), or when the package is uninstalled.

In this chapter we will discuss about the package format, package execution and rollback.

Package Format

A package is assembled as a ZIP file that contains the bundles, configuration files or libraries you want to install, along with some special files that describe the install process.

Here is a list of the special files (you should avoid to use these file names for installable resources).

  • package.xml - The package descriptor describing the package metadata, dependencies and custom handlers to be used when installing it. See [Package Manifest]({{page page='package-manifest'}}) for more details on the file format.

  • install.xml - Contains the installation instructions. There are two possible formats for this file: either an XML package command file, or an Ant script to be used to install the package. Using Ant is discouraged, you should consider using the package command to describe an installation rather than Ant since rollback is ensured to be safe. See [Scripting Commands]({{page page='scripting-commands'}}) for more details on the commands file format.

  • uninstall.xml - Contains the uninstallation instructions. When using commands to describe the install process this file will be automatically generated (no need to write it). When using Ant for the installation you must write the uninstallation Ant file too.

  • install.properties - A Java property file containing user preferences (if any was specified during the install wizard). This file is automatically generated by the installer.

  • backup - A directory created by the install process (when using commands to describe the install) to backup the existing files that were modified. The content of this directory will be used by the rollback process to revert changes. See [Scripting Commands]({{page page='scripting-commands'}}) for more details on rollback.

  • license.txt - A text file containing the license of the software you want to install. This file is optional.

  • content.html - A file containing an HTML description of your package. This file can use references to resources (such as images) located in the package zip - for example you may want to display a set of screenshots for the new feature installed by the package. This file is optional.

  • forms - A directory containing custom wizard form definitions. This directory and all the files inside are optional.

    {{#> callout type='warning' }}

    Forms, which are base on the ParametrizedCopy command, are more or less deprecated since they currently work only under the following conditions (NXP-14777):

    • not under Windows,
    • the package is hotreloadable (NXP-8241),
    • DEV mode is activated.

    Instead, you should use [a custom configuration template]({{page page='configuration-templates'}}) deployed and activated by the package, then configured by the server administrator from nuxeo.conf.

    {{/callout}}

    There are three type of wizard forms you can contribute:

    • install.xml - Install forms (i.e. forms added to the install wizard for packages that needs user parameterization).
    • uninstall.xml - Uninstall forms (i.e. forms added to the uninstall wizard for packages that needs user parameterization).
    • validation.xml - Validation forms (i.e. forms used by the install validator if any is needed).

Apart these special files you can put anything inside a package (web resources, jars, Java or Groovy classes etc.). It is recommended to group your additional resources in sub directories to keep a clean structure for your package.

You can see that most of the files listed above are optional or generated. So for a minimal package you will only need 2 files: the package.xml and the install.xml file.

The Package Manifest

The package metadata is stored in the package.xml file.

Here is the list of mandatory and highly recommended properties defining a package:

  • name: The package name.
  • version: The package version.
  • title: The package title to be displayed to the user.
  • type: The package type. One of: studio, hotfix, or addon.
  • platforms: A list of supported platform versions.
  • vendor: The identifier of the package vendor.
  • home-page: An URL to the home page of the package (or documentation) if any.
  • visibility: The visibility determines the channel where the package will be distributed on (for public, private or registered users).

For more information on the package properties and the XML format see [Package Manifest]({{page page='package-manifest'}}).

Scripting Commands

XML commands are the default way to describe the installation instructions. The advantage of using commands is that the rollback and uninstall scripts will be automatically generated.

See [Scripting Commands]({{page page='scripting-commands'}}) for more details on using commands.

Below is the list of available properties you can use in command files to parametrize your commands.

Context Properties Available in Scripting Commands

Here is the list of properties available to install scripts:

  • all the system properties in the running JVM.
  • package.id: The Package identifier.
  • package.name: The Package name.
  • package.version: The Package version.
  • package.root: The root folder of the package (the folder containing the exploded zip).
  • env.server.home: Since 5.5. The Nuxeo server home ($NUXEO_HOME).
  • env.home: The Nuxeo Runtime Environment home ($NUXEO_HOME/nxserver).
  • env.lib: The Nuxeo lib directory ($NUXEO_HOME/nxserver/lib).
  • env.syslib: The host application lib directory ($NUXEO_HOME/lib).
  • env.bundles: The Nuxeo bundles directory ($NUXEO_HOME/nxserver/bundles).
  • env.config: The Nuxeo config directory ($NUXEO_HOME/nxserver/config).
  • env.templates: The configuration templates directory ($NUXEO_HOME/templates).
  • env.hostapp.name: The host application name (Tomcat)
  • env.hostapp.version: The host application version Tomcat version)
  • sys.timestamp: The timestamp when the install task was created - a string in the format yyMMddHHmmss.

Create an Empty Nuxeo Package

From a Maven Multi-Module Project

We assume that you already bootstrapped your project with [Nuxeo CLI]({{page page='nuxeo-cli'}}), or your project is following the mechanism described by Maven as a multi-module project.

$ cd my-project
$ nuxeo bootstrap package

If you previously generated the project using [Nuxeo CLI]({{page page='nuxeo-cli'}}), then you will be prompted only for the package name. Otherwise, you will also be prompted for:

  • Parent Group ID - root POM groupId value.
  • Parent Artifact ID - root POM artifactId value.
  • Parent Version - root POM version value.
     info You'll be prompted for generation of:
     info   my-project-package: package

   create Generate Module: my-project-package

   create Generating Package
     info   Parameters: Parent group, Parent artifact, Parent version, Package artifact, Package version, Package name, Company name
? Parent Group id: org.nuxeo.sample.project
? Parent Artifact id: my-project-parent
? Parent version: 1.0-SNAPSHOT
? Package Artifact id: my-project-package
? Package name: My Project
? Company name: Nuxeo
   create my-project-package/pom.xml
   create my-project-package/src/main/assemble/assembly.xml
   create my-project-package/src/main/resources/install/templates/my-project/nuxeo.defaults
   create my-project-package/src/main/resources/install.xml
   create my-project-package/src/main/resources/package.xml
     info You can start editing code or you can continue with calling another generator (nuxeo bootstrap [<generator>..])
  • my-project/src/main/resources/package.xml is your [Package Manifest]({{page page='package-manifest'}}).
  • my-project/src/main/resources/install.xml is your [Scripting Commands Descriptor]({{page page='scripting-commands'}}).

You just created an empty package, without any additional dependency for now. Edit the newly created pom.xml file to add your project artifacts, for instance the one whose GAV is org.bigcorp.sample.project:my-project-core:1.0-SNAPSHOT.

  <dependencies>
    ...
    <!-- Additional bundles to be deployed by the package -->
    <dependency>
      <groupId>org.bigcorp.sample.project</groupId>
      <artifactId>my-project-core</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>
  </dependencies>

Run mvn package to generate your Nuxeo Package and read [installing a Nuxeo Package]({{page version='' space='nxdoc' page='installing-a-new-package-on-your-instance'}}) to deploy it.

From a Maven Single Module Project

In order to create a dedicated package for a Maven single module project, you have to create a separate project that will contain a dependency to your project.

$ cd my-project && cd .. # Move to the parent folder of your project root
$ mkdir my-project-package && cd $_ # Create a dedicated folder
$ nuxeo bootstrap package # Bootstrap package

You will be prompted for parent artifact informations; if your company has a BOM you should know what to fill. Otherwise you can follow this example using nuxeo-distribution, it will brings all Nuxeo dependencies at once:

     info You'll be prompted for generation of:
     info   my-project-package: package

   create Generate Module: my-project-package

   create Generating Package
     info   Parameters: Parent group, Parent artifact, Parent version, Package artifact, Package version, Package name, Company name
? Parent Group id: org.nuxeo.ecm.distribution
? Parent Artifact id: nuxeo-distribution
? Parent version: 8.10
? Package Artifact id: my-project-package
? Package Version: 1.0-SNAPSHOT
? Package name: My Project
? Company name:
   create pom.xml
   create src/main/assemble/assembly.xml
   create src/main/resources/install/templates/my-project/nuxeo.defaults
   create src/main/resources/install.xml
   create src/main/resources/package.xml
     info You can start editing code or you can continue with calling another generator (nuxeo bootstrap [<generator>..])

You just created an empty package; without any additional dependency for now. Edit the newly created pom.xml file to add your project artifacts as for a multi-module project.

Run mvn package to generate your Nuxeo Package and read [installing a Nuxeo Package]({{page version='' space='nxdoc' page='installing-a-new-package-on-your-instance'}}) to deploy it.