Using Gradle to create OSGi bundles with DS annotations

BND Plugin Approach

[https://github.com/bndtools/bnd/blob/master/biz.aQute.bnd.gradle/README.md#gradle-plugin-for-non-workspace-builds]

{CODE(caption="OSGi Plugin with Annotated Declarative Services" wrap="1" colors="Java")}buildscript { repositories { jcenter() } dependencies { classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:3.2.0' } }

apply plugin: 'biz.aQute.bnd.builder'

dependencies { compileOnly 'org.osgi:org.osgi.service.component.annotations:1.3.0' }{CODE}

OSGi Plugin Approach

{CODE()}buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath 'org.jayware:gradle-osgi-ds:0.5.1' } }

apply plugin: 'java' apply plugin: 'osgi' apply plugin: 'osgi-ds'

dependencies { compileOnly 'org.osgi:org.osgi.service.component.annotations:1.3.0' }

jar { manifest { instruction "Service-Component", "OSGI-INF/*.xml" } }{CODE}