Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
gradle recipe for OSGi uberjar
apply plugin: 'java'
apply plugin: 'osgi'
configurations {
repositories {
mavenRepo url: ''
dependencies {
runtime 'org.scala-lang:scala-library:2.9.1'
testCompile 'junit:junit:4.10'
//add all the configurations/modules you want to include in the uberJar
uberJar configurations.runtime
uberJar configurations.testCompile {
//exclude transitive dependencies
exclude group:'org.hamcrest', artifact:'hamcrest-core', version:'1.1'
jar {
classifier = 'osgi'
configurations.uberJar.each { from zipTree(it) }
//generic file excludes when filling jar
exclude 'META-INF/**', 'LICENSE.txt'
manifest {
name = 'foo-osgi'
attributes 'Manifest-Version':'1.0', 'Created-By':''
instruction 'Bundle-Vendor', 'MyCompany'
doLast {
ant.signjar(jar: archivePath, keystore: './foo.jks', storepass: 'foobar', alias: 'osgi-key')

This comment has been minimized.

Copy link
Owner Author

@dexterous dexterous commented Dec 14, 2011

Some help from the guys in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.