Creating Nuxeo Packages

Package Example

Updated: October 16, 2020

The following example is imaginary - it is not a real Nuxeo Marketplace Package. Its purpose is to be an example of a complex package install on a Nuxeo distribution.

In this example we will create a package to install Nuxeo Automation feature on a 5.3.2 version of Nuxeo DM.

What we want to install

Nuxeo Automation is composed of 3 Nuxeo bundles:

  • nuxeo-automation-core-5.3.2.jar
  • nuxeo-automation-server-5.3.2.jar
  • nuxeo-automation-jsf-5.3.2.jar

and one third party library:

  • mvel2-2.0.16.jar

This library is not existing on a 5.3.2 version of Nuxeo so we want to add it (not to upgrade it).

Also, for Tomcat distributions we need to deploy a file in Nuxeo configuration directory. This file contains the SMTP configuration needed by javax.mail. On JBoss we already have this configuration as a JBoss MBean. This configuration is required by the SendMail operation. The configuration file is a Java property file and contains variables that will be substituted by the values entered by the user during the install wizard. 

Here is the parameterized file we want to install:${}

The package structure

Here is the structure of our package:

The package.xml descriptor

Here is our Package Manifest:

<package type="addon" name="nuxeo-automation" version="5.3.2">
  <title>Nuxeo Automation</title>
  <description>A service that enable building complex business logic on top of Nuxeo services using scriptable operation chains</description>
  <classifier>Open Source</classifier>

The install form

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,
  • MP is hot-reloadable (NXP-8241),
  • and DEV mode is activated.

Instead, you should use a custom configuration template deployed and activated by the MP, then configured by the server administrator from nuxeo.conf

We need to define an additional page for the install wizard to ask for the properties needed to inject in the file.

Here is the form definition we need

    <title>SMTP configuration</title>
    <description>Fill the SMTP configuration to be used by the SendMail operation. All fields are required</description>
      <field name="" type="string" required="true">
      <field name="mail.smtp.port" type="integer" required="true">
      <field name="mail.smtp.user" type="string" required="true">
      <field name="mail.smtp.password" type="password" required="true">

Note that the field IDs in the form are the same as the variable keys we need to inject into the file

The install.xml script

Here is the content of the install.xml file:

  <!-- copy bundles -->
  <copy file="${package.root}/bundles/nuxeo-automation-core-5.3.2.jar" tofile="${env.bundles}"/>
  <copy file="${package.root}/bundles/nuxeo-automation-jsf-5.3.2.jar" tofile="${env.bundles}"/>
  <copy file="${package.root}/bundles/nuxeo-automation-server-5.3.2.jar" tofile="${env.bundles}"/>
  <!-- copy libs -->
  <copy file="${package.root}/lib/mvel2-2.0.16.jar" tofile="${env.lib}"/>
  <!-- copy the parametrized file -->
  <pcopy file="${package.root}/config/" tofile="${env.config}" ignore="Platform.isJBoss()" />
  <!-- now deploy copied bundle: we don't require a server restart -->
  <deploy file="${env.bundles}/nuxeo-automation-core-5.3.2.jar" />
  <deploy file="${env.bundles}/nuxeo-automation-server-5.3.2.jar" />
  <deploy file="${env.bundles}/nuxeo-automation-jsf-5.3.2.jar" />

You can see the is not installed if the package install target is a JBoss-based distribution.

We'd love to hear your thoughts!

All fields required