Class BndManifestPlugin

  • All Implemented Interfaces:
    Plugin<Project>

    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 if Bundle-Version hasn't been set explicitly. * Replaces `-SNAPSHOT` in the version with `.IyyyyMMddkkmm` (to-the-minute timestamp). * Passes the runtime configuration's classpath to bnd for manifest calculation. * Instructs bnd to respect the result of the processResources task. 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.
    • Constructor Detail

      • BndManifestPlugin

        public BndManifestPlugin()
    • Method Detail

      • applyOnce

        protected void applyOnce​(Project project)
        Description copied from class: ProjectPlugin
        Plugin application, which is guaranteed to execute only once.
        Specified by:
        applyOnce in class ProjectPlugin