The PKG-MVN-Plugin provides a maven plugin for packaging maven projects to different targets. It supports on-the-fly generation of.deb, .rpm and .ipkg packages as well as the generation of IzPack-installer.
One of the goals of this plugin was the clean handling of maven dependencies. For the distribution specific packaging targets, the plugin is able to translate the maven dependencies to platform specific (e.g. Debian) dependencies.
This quick start guide covers the 4.X maven-pkg-plugin and 5.X pkg-maven-plugin.
To use the plugin, you have to configure the tarent maven plugin repository in your '~/.m2/settings.xml' or the 'pom.xml' of your project.
<pluginRepositories>
<pluginRepository>
<id>tarent-maven-releases</id>
<url>https://repo-bn-01.lan.tarent.de/repository/maven-releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
After configuring the plugin provides the following goals:
- pkg:pkg
-
The packages are created based on the targetConfigurations (think profiles) defined in your 'pom.xml'.
- pkg:upload
-
The resulting packages are copied/uploaded to another location (i.e. scpexe://, ftp://, [../../../ file://], and apt repositories among others)
This configuration creates a package for Ubuntu Lucid. This package will be part of the section "devel", and will be provided with a starter script that will execute the mainClass when called. For a complete reference of all possible parameters, please consult the User Manual.
[...]
<plugins>
[...]
<plugin>
<groupId>de.tarent.maven.plugins</groupId>
<artifactId>maven-pkg-plugin</artifactId>
<version>4.0.11</version>
<!-- 5.x Release
<artifactId>pkg-maven-plugin</artifactId>
<version>5.0.4</version>
-->
<configuration>
<target>desktop_deb</target>
<targetConfigurations>
<targetConfiguration>
<target>desktop_deb</target>
<defaultDistro>ubuntu_lucid</defaultDistro> <!-- Not needed if distros.size() == 1 -->
<distros>
<distro>ubuntu_lucid</distro>
<distro>ubuntu_karmic</distro>
</distros>
<release>Release Number XX</release>
<architecture>x86_64</architecture>
<mainClass>org.test.project.MainClass</mainClass>
<section>devel</section>
<maintainer>Maintainer Name Jr.</maintainer>
<!-- Following sections are not mandatory -->
<revision>r0</revision>
<!-- Override the defaultDependencyLine from the distribution package maps.
Be careful when using multiple distributions, because it will be
overwritten for all distributions.
-->
<defaultDependencyLine>
openjdk-7-jre-headless</defaultDependencyLine>
<manualDependencies>
<string>kdm</string>
[...]
</manualDependencies>
<sysconfFiles>
<sysconfFile>
<from>dummy.properties</from>
<to>dummyProject/dummy.properties</to>
<rename>true</rename>
</sysconfFile>
[...]
</sysconfFiles>
<-- maven wagon is used internally -->
<uploadParameters>
<urls>
<url>scpexe://targetuploadserver/targetdir</url>
<url>ftp://targetuploadserver2/targetdir</url>
[...]
</urls>
</uploadParameters>
</targetConfiguration>
[...]
</targetConfigurations>
</configuration>
</plugin>
[...]
</plugins>
[...]