Package com.diffplug.gradle.osgi
Class BndManifestPlugin
- java.lang.Object
-
- com.diffplug.gradle.ProjectPlugin
-
- com.diffplug.gradle.osgi.BndManifestPlugin
-
public class BndManifestPlugin extends ProjectPlugin
Generates a manifest using purely bnd, and outputs it for IDE consumption. Generating manifests by hand is a recipe for mistakes. Bnd does a fantastic job generating all this stuff for you, but there's a lot of wiring required to tie bnd into both Eclipse PDE and Gradle. Which is what Goomph is for! ```groovy apply plugin: 'com.diffplug.osgi.bndmanifest' // Pass headers and bnd instructions: https://bnd.bndtools.org/chapters/825-instructions-ref.html jar.manifest.attributes( '-exportcontents': 'com.diffplug.*', '-removeheaders': 'Bnd-LastModified,Bundle-Name,Created-By,Tool,Private-Package', 'Import-Package': '!javax.annotation.*,*', 'Bundle-SymbolicName': "${project.name};singleton:=true", ) // The block below is optional. osgiBndManifest { // The manifest will always be included in the built jar // at the proper 'META-INF/MANIFEST.MF' location. But if // you'd like to easily see the manifest for debugging or // to help an IDE, you can ask gradle to copy the manifest // into your source tree. copyTo 'src/main/resources/META-INF/MANIFEST.MF' // By default, the existing manifest is completely ignored. // The line below will cause the existing manifest's fields // to be merged with the fields set by bnd. mergeWithExisting true } ``` Besides passing raw headers and bnd directives, this plugin also takes the following actions: * Passes the project version to bnd ifBundle-Versionhasn't been set explicitly. * Replaces `-SNAPSHOT` in the version with `.IyyyyMMddkkmm` (to-the-minute timestamp). * Passes theruntimeconfiguration's classpath to bnd for manifest calculation. * Instructs bnd to respect the result of theprocessResourcestask. Many thanks to JRuyi and Agemo Cui for their excellent [osgibnd-gradle-plugin](https://github.com/jruyi/osgibnd-gradle-plugin). This plugin follows the template set by their plugin, but with fewer automagic features and tighter integrations with IDEs and gradle's resources pipeline.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBndManifestPlugin.Legacy
-
Constructor Summary
Constructors Constructor Description BndManifestPlugin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidapplyOnce(Project project)Plugin application, which is guaranteed to execute only once.-
Methods inherited from class com.diffplug.gradle.ProjectPlugin
apply, getPlugin, treeDef
-
-
-
-
Method Detail
-
applyOnce
protected void applyOnce(Project project)
Description copied from class:ProjectPluginPlugin application, which is guaranteed to execute only once.- Specified by:
applyOncein classProjectPlugin
-
-