2.2. Packaging

Warning

You are looking at documentation for an older release. Not what you want? See the current release documentation.

The Add-ons Manager defines a standard approach of packaging, installing/uninstalling and updating add-ons. To comply with it, you need to compress JARs, WARs and other files into a zip archive:

foo-addon-X.Y.Z.zip/
|__ foo-addon.jar
|__ somelib.jar
|__ foo-portlets.war
|__ foo-extension.war
|__ foo
    |__ foo.conf
|__ README

When installing an add-on, the Add-ons Manager copies files from the add-on archive into eXo Platform, as follows:

Packaging sample

You can use Maven assembly plugin to package your add-on project.

See the sample at eXo Samples Repository. Notice two files:

In packaging/pom.xml:


<build>
    <finalName>${project.artifactId}-${project.version}</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                    <id>package-extension</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <finalName>${project.artifactId}-${project.version}</finalName>
                        <appendAssemblyId>false</appendAssemblyId>
                        <descriptors>
                            <descriptor>src/main/assemblies/packaging.xml</descriptor>
                        </descriptors>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

In packaging/src/main/assemblies/packaging.xml:


<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    <id>addon-packaging-template</id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <useProjectArtifact>false</useProjectArtifact>
            <outputDirectory>/</outputDirectory>
            <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
            <includes>
                <include>org.exoplatform.samples:addon-template-webapp</include>
                <include>org.exoplatform.samples:addon-template-lib</include>
            </includes>
        </dependencySet>
    </dependencySets>
</assembly>
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus