Wednesday, February 29, 2012

Deploying Swing applications on Linux with Maven and RPM

In the final part of application deployment series, I'll cover how to deploy Swing application as an RPM package. For this purpose, I'll use Maven RPM plugin to integrate deployment with application build process. Note that rpm tool must be installed on a system in order for this to work.

We start with simple Maven project as usual, and then configure Maven RPM plugin to run during package phase. Plugin configuration is shown in code snippet bellow:


In the first part of configuration, we set the plugin to run rpm goal during install phase. We also set copyright and group information, which are mandatory. Copyright refers to application license, and  group to software group it should belong to.

File mapping is the most important part. In each mapping element, we set target directory for installation, and application files that should go in it. You can check out project source code attached to this post to see what each file does. In short:
  • - a shell script to execute the application
  • myapp.png - application icon
  • myapp.desktop - application desktop file
Final part of configuration lists package dependencies. We set it to require Java 7. Please note that this package name is valid for Fedora, while on other distributions it can be different. This should be taken into account when configuring dependencies.

The image bellow shows Fedora start menu with our application installed,
Start menu with application installed

Source code for this project can be found here 
You can also check out previous posts from this series:

No comments:

Post a Comment