Skip to content

Instantly share code, notes, and snippets.

@tzachz
Created February 27, 2013 12:59
Show Gist options
  • Save tzachz/5047739 to your computer and use it in GitHub Desktop.
Save tzachz/5047739 to your computer and use it in GitHub Desktop.
Dropwizard gradle build file
// fetch the relevant plugin code
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'eu.appsatori:gradle-fatjar-plugin:0.2-rc1'
classpath 'com.kenshoo:gradle-fpm:+'
}
}
// apply, configure, and run fatJar task when building
apply plugin: 'fatjar'
fatJar {
manifest { attributes 'Main-Class': 'your.main.DropwizardServiceClass'
attributes 'Implementation-Version': '1.0' }
}
build.dependsOn fatJar
// wrap jar, upstart and yml into deb package:
apply plugin: 'fpm-packaging'
def stagingDir = new File(project.buildDir, "staging")
task stageFiles(type: Copy) {
stagingDir.mkdir()
// place yml file and jar under /opt/sample-dw-service
into new File(stagingDir, "/opt/sample-dw-service")
from 'sample-dw-service/build/resources/main/server.yml'
from 'build/libs'
// place upstart file under /etc/init
into('../../etc/init') {
from 'sample-dw-service/build/resources/main/sample-dw-service.conf'
}
}
// configure plugin to package the staging dir we've
// just created, and to declare java-7 dependency
packaging {
dependencies = ['openjdk-7-jre']
baseDir = stagingDir
}
debian.dependsOn stageFiles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment