Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

This sections presents a simple "Hello World" component defined using annotations, and also explains how to build the bundle using either Bnd, Ant, or Maven.

Hello World Component

...

No Format
Bundle-Name: Hello World Using Dependency Manager Annotations
Bundle-SymbolicName: org.apache.felix.dependencymanager.samples.annotation.hello
Import-Package: *
Private-Package: org.apache.felix.dependencymanager.samples.annotation.hello
-plugin org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin;log=warn

Compiling with Ant:

Since Bnd provides a Ant task, you can use the bnd directives above with the following build.xml:
(it is assumed that directives.bnd, bnd.jar, json-20070829.jar and org.apache.felix.dependencymanager.annotation.jar are in the current directory)

No Format

<project name="TestDM" default="bnd">
	<property name="bnd" value="bnd.jar" />
	<property name="json" value="json-20070829.jar" />
	<property name="dmannot" value="org.apache.felix.dependencymanager.annotation.jar" />

	<target name="compile">
		<delete dir="target/classes" quiet="yes" />
		<mkdir dir="target/classes" />
		<javac srcdir="src/main/java" destdir="target/classes" classpath="${dmannot}" />
	</target>

	<target name="bnd" depends="compile">
		<taskdef resource="aQute/bnd/ant/taskdef.properties" classpath="${dmannot}:${bnd}:${json}" />
		<bnd classpath="target/classes" eclipse="false" files="directives.bnd" output="org.apache.felix.dependencymanager.samples.annotation.hello.jar" />
	</target>
</project>

Compiling with Maven:

When compiling with Maven, you have to use the Dependency Manager Maven annotation plugin:

...