Skip to content

Instantly share code, notes, and snippets.

@dexterous
Created December 13, 2011 23:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dexterous/69b563a83914b278e2a3 to your computer and use it in GitHub Desktop.
Save dexterous/69b563a83914b278e2a3 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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