Configuration

The configuration of the Debian Package Maven Plugin has the following structure:

...
<configuration>
        ...
        <control>
                ...
        </control>
        <scripts>
                <script>
                        ...
                </script>
        </scripts>
        <copyright>
                ...
        </copyright>
        <changeLog>
        </changeLog>
        <data>
        </data>
        <properties>
        </properties>
        ...
</configuration>
...

The control, copyright, changeLog and data elements are required. The scripts and properties elements are optional.

Control

Class: ControlConfiguration

The control element contains all the information which will be stored in the control file of the Debian package.

For a in-depth description of the fields and their format have a look at the Chapter 5 - Control files and their fields of the Debian Policy Manual.

<control>
        <name>[NAME]</name>
        <version>[VERSION]</version>
        <architecture>[ARCHITECTURE]</architecture>
        <section>[SECTION]</section>
        <priority>[PRIORITY]</priority>
        <installedSize>[INSTALLED-SIZE]</installedSize>
        <depends>
                [DEPENDENCIES]
        </depends>
        <recommends>
                [DEPENDENCIES]
        </recommends>
        <suggests>
                [DEPENDENCIES]
        </suggests>
        <enhances>
                [DEPENDENCIES]
        </enhances>
        <preDepends>
                [DEPENDENCIES]
        </preDepends>
        <breaks>
                [DEPENDENCIES]
        </breaks>
        <conflicts>
                [DEPENDENCIES]
        </conflicts>
        <provides>
                [DEPENDENCIES]
        </provides>
        <replaces>
                [DEPENDENCIES]
        </replaces>
        <builtUsing>
                [DEPENDENCIES]
        </builtUsing>
        <maintainer>[MAINTAINER]</maintainer>
        <homepage>[HOMEPAGE]</homepage>
        <description>[DESCRIPTION]</description>
</control>

The installedSize element is optional. If it is not present the plugin will calculate the installed size by sum up the size of all added files. If it is present the value will be used (the value is in kilobytes). If the element is present and contains a number with a + sign as a prefix the plugin will sum up the size of all added files and add that value to it (the value is in kilobytes).

For the structure of the dependency elements depends, recommends, suggest, enhances, preDepends, breaks, conflicts, provides, replaces and builtUsing see the dependencies section.

Dependencies

Class: DependenciesConfiguration

For a in-depth description of dependencies have a look at the Chapter 7 - Declaring relationships between packages of the Debian Policy Manual.

...
<dependencies>
        <dependency>[DEPENDENCY]</dependency>
        ...
</dependencies>
...

Scripts

Class: ScriptConfiguration

The scripts element contains definitions about the package maintainer scripts preinst, postinst, prerm, postrm. If one of these is not defined a standard script will be used instead.

For a in-depth description of the package maintainer scripts have a look at the Chapter 6 - Package maintainer scripts and installation procedure of the Debian Policy Manual.

There are two different kind of configurations possible for each script: It is possible to define a file which will be used for the script and it is also possible to define the content of that file directly in the configuration.

Maven properties (e.g. $project.version) can be used in the file based scripts and will be replaced by the corresponding values during the creation of the Debian package. Additional properties can also be defined in the properties section of the configuration. These will be only available within the plugin.

...
<scripts>
        <script>
                <type>[TYPE]</type>
                <file>[FILE]</file>
        </script>
        ...
</scripts>
...
...
<scripts>
        <script>
                <type>[TYPE]</type>
                <content>
                        [CONTENT]
                </content>
        </script>
        ...
</scripts>
...

For the type element the following values are supported (case-sensitive):

  • PREINST - the script which is executed before the files are extracted or updated.
  • POSTINST - the script which is executed after the files were extracted or updated.
  • PRERM - the script which is executed before the files are deleted or updated.
  • POSTRM - the script which is executed after the files were deleted or updated.

Copyright

Class: CopyrightConfiguration

Contains the copyright of the Debian package.

For a in-depth description of the copyright have a look at the 12.5 Copyright information of the Debian Policy Manual.
Also have a look at the Machine-readable debian/copyright file.

There are two different kind of configurations possible: It is possible to define a file which will be used for the copyright file and it is also possible to define the content of that file directly in the configuration.

...
<copyright>
        <file>[FILE]</file>
</copyright>
...
...
<copyright>
        <upstreamName>[UPSTREAM-NAME]</upstreamName>
        <upstreamContact>[UPSTREAM-CONTACT</upstreamContact>
        <source>[SOURCE]</source>
        <disclaimer>[DISCLAIMER]</disclaimer>
        <comment>[COMMENT]</comment>
        <license>
                <name>[NAME]</name>
                <text>[TEXT]</text>
        </license>
        <copyright>[COPYRIGHT]</copyright>
        <files>
                <file>
                        <files>
                                <file>[PATTERN]</file>
                                ...
                        </files>
                        <copyright>[COPYRIGHT]</copyright>
                        <license>
                                <name>[NAME]</name>
                                <text>[TEXT]</text>
                        </license>
                        <comment>[COMMENT]</comment>
                </file>
                ...
        </files>
        <licenses>
                <license>
                        <name>[NAME]</name>
                        <text>[TEXT]</text>
                </license>
                ...
        </licenses>
</copyright>
...

If a license is used several times it can be defined in the licenses element and by referred by its name.

ChangeLog

Class: ChangeLogConfiguration

Contains the change log of the Debian package.

For a in-depth description of the change log have a look at the 12.7 Changelog files of the Debian Policy Manual.
Also have a look at the 4.4 Debian changelog: debian/changelog.

There are two different kind of configurations possible: It is possible to define a file which will be used for the copyright file and it is also possible to define the content of that file directly in the configuration.

It is recommended to use a file which is created at previous other point of the build process by e.g. querying the SCM or the issue management as it should contain the whole history of the project.

<changeLog>
        <file>[FILE]</file>
</changeLog>
<changeLog>
        <entries>
                <entry>
                        <name>[NAME]</name>
                        <version>[VERSION]</version>
                        <distributions>
                                <distribution>[DISTRIBUTION]</distribution>
                                ...
                        </distributions>
                        <urgency>[URGENCY]</urgency>
                        <details>
                                <detail>[DETAIL]</detail>
                                ...
                        </details>
                        <maintainer>[MAINTAINER]</maintainer>
                        <date>[DATE]</date>
                </entry>
                ...
        </entries>
</changeLog>

Data

Class: DataConfiguration

Defines the directories, files and symbolic links which should be added to the Debian package.

The standard directories don't need to be defined (e.g. like /usr/local). In all other cases directories have to be defined, if they are not created by a recursive adding of files.

<data>
        <entries>
                <entry>
                        <sourcePath>[SOURCE-PATH]</sourcePath>
                        <targetPath>[TARGET-PATH]</targetPath>
                        <symLinkPath>[SYM-LINK-PATH]</symLinkPath>
                        <groupId>[GROUP-ID]</groupId>
                        <groupName>[GROUP-NAME]</groupName>
                        <userId>[USER-ID]</userId>
                        <userName>[USER-NAME]</userName>
                        <mode>[MODE]</mode>
                        <recursive>[RECURSIVE]</recursive>
                        <process>[PROCESS]</process>
                        <encoding>[ENCODING]</encoding>
                </entry>
                ...
        </entries>
</data>

Entry flags

The groupId, groupName, userId, userName and mode elements can be used for a directory, a file and a symbolic link.

If they are not defined default values will be used. These are the following:

Element Default value
groupId 0
groupName root
userId 0
userName root
mode For a directory: 0755 (octal) 
For a file: 0644 (octal

Directory

If a directory should be created by the Debian package only the targetPath element must be defined (e.g. /usr/local/myprogram/).

<data>
        <entries>
                <entry>
                        <targetPath>[TARGET-PATH]</targetPath>
                </entry>
                ...
        </entries>
</data>

A directory can also be added recursively by using the recursive element. In this case the sourcePath element has to be defined and point to a directory (e.g. $project.build.outputDirectory/jar/).

<data>
        <entries>
                <entry>
                        <sourcePath>[SOURCE-PATH]</sourcePath>
                        <targetPath>[TARGET-PATH]</targetPath>
                        <recursive>[RECURSIVE]</recursive>
                </entry>
                ...
        </entries>
</data>

File

If a file should be added to the Debian package also the sourcePath element has to be defined. It must contain the path of the file during the build (e.g. $project.build.outputDirectory/jar/mylib.jar).

In that case process element can be used to define if that file should be processed by the plugin during its execution (should only be enabled for text files). The plugin will create a copy of the source file and replace all Maven properties (e.g. $project.version) within it. Additional properties can also be defined in the properties section of the configuration. These will be only available within the plugin.

If the process flag is set to true the encoding of the file can be specified by the encoding element. If it is not specified the source encoding $project.build.sourceEncoding will be used. If that is also not available the default encoding of the JVM of Maven will be used (Charset.defaultCharset();).

<data>
        <entries>
                <entry>
                        <sourcePath>[SOURCE-PATH]</sourcePath>
                        <targetPath>[TARGET-PATH]</targetPath>
                        <process>[PROCESS]</process>
                        <encoding>[ENCODING]</encoding>
                </entry>
                ...
        </entries>
</data>

For adding more than one file at a time also a pattern can be defined for the source path (e.g. $project.build.outputDirectory/lib/*.jar). The standard Maven wildcards can be used.

Is it also possible to combine that with the recursive element which was described in the directory section.

Symbolic link

A symbolic link can be added by using the symLinkPath element. In that case the targetPath is the name of the link (e.g. /usr/local/myprogram/myprogram) and the symLinkPath is the path of the target (e.g. /usr/local/myprogram/bin/myrealprogram).

Symbolic links can also be defined for directories, of course. In that case the path defined in the symLinkPath element has to point to a directory.

<data>
        <entries>
                <entry>
                        <targetPath>[TARGET-PATH]</targetPath>
                        <symLinkPath>[SYM-LINK-PATH]</symLinkPath>
                </entry>
                ...
        </entries>
</data>

Properties

The plugin offers the possibility to define properties which are only available within the execution context of the plugin.

These properties can be used in the scripts as well as during the processing of added files.

<properties>
        <property>
                <name>[NAME]</name>
                <value>[VALUE]</value>
        </property>
        ...
</properties>