Created
December 13, 2011 23:40
-
-
Save dexterous/69b563a83914b278e2a3 to your computer and use it in GitHub Desktop.
gradle recipe for OSGi uberjar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some help from the guys in http://markmail.org/thread/bigprn52qon4dl7n