Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
gradle recipe for OSGi uberjar
apply plugin: 'java'
apply plugin: 'osgi'
configurations {
uberJar
}
repositories {
mavenCentral()
mavenRepo url: 'http://scala-tools.org/repo-releases'
}
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':'saager.mhatre@gmail.com'
instruction 'Bundle-Vendor', 'MyCompany'
}
doLast {
ant.signjar(jar: archivePath, keystore: './foo.jks', storepass: 'foobar', alias: 'osgi-key')
}
}
@dexterous

This comment has been minimized.

Copy link
Owner Author

@dexterous dexterous commented Dec 14, 2011

Some help from the guys in http://markmail.org/thread/bigprn52qon4dl7n

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.