Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Groovy Shell
Tree: 71675450a6

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


A basic Ubuntu/Debian packager plugin for Gradle. It has some quirks but it should be possible to use it to create packages.

Example Project

The below examples come from the example project helloworld-example

build.gradle example

buildscript {
    repositories {
        mavenRepo urls:''
    dependencies {
        classpath "be.thinkerit.gradle:ubuntu-packager-plugin:0.1"

apply plugin:'ubuntu'

version = '0.1'

ubuntu {
    archive = new File("helloworld.tar.gz").toURI()
    releaseNotes = "Example for the ubuntu packager plugin"
    author = 'me'
    email = ''
    homepage = ''
    depends {
        // uncomment to add dependencies to be installed
        // on 'mysql-server'
        // on 'jetty'
    dirs {
        // you can add as many dir statements as you need
        dir '/usr/share/helloworld/bin'


dir structure

├── build.gradle
├── helloworld.tar.gz
└── src
    └── ubuntu
        └── debian
            ├── copyright
            └── helloworld-example.install

The following optional scripts can be added to src/ubuntu/debian

  • helloworld-example.default -- /etc/default/helloworld-example holds environment variable defaults
  • helloworld-example.init -- /etc/init.d/helloworld-example system start-stop script
  • helloworld-example.preinst -- executed before installation
  • helloworld-example.postinst -- executed after installation
  • helloworld-example.prerm -- executed before removal
  • helloworld-example.postrm -- executed after removal

Finally you can still add any number of custom files to src/ubuntu/overrides which are copied to the same level as the contents of the tgz so they are available for use in helloworld-example.install

See the packaging guide as for the format to use in these files.


~/helloworld-example$ gradle clean deb


The plugin expects the presence of a tgz which isn't common for Java projects though not hard to make.

The package will be named based on the gradle name property which is the same as the directory in which the gradle project is located. As a result when using a CI system such as jenkins this name/dir will be called workspace and is probably not what you want. To work around this I have been putting my package scripts in their own subdir named the way I want the package to be named.


  • myapp/grails
  • myapp/myapp
  • myapp/myapp-data

So far the plugin will create debian packages based on the architecture on which the package is build. As I intend to use this for Java projects this should be changed to all instead in a future version. Or the target platform when using platform specific compilers.

Something went wrong with that request. Please try again.