I’m playing around with the Felix OSGi container to create some basic OSGi support for NetBeans. It should allow you to start and stop Felix and add a project Type to create OSGi bundles. There’s a Options Panel to let you set the felix install dir and use it from there. To use this as a property in Ant build skripts I need to set it globally. That’s easy with the Global Properties:
try {
EditableProperties ep = PropertyUtils.getGlobalProperties();
ep.setProperty(“felix.install.dir”, dir);
PropertyUtils.putGlobalProperties(ep);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
Now all build scripts can access this property…
Update: Here’s an example
<project name="de.eppleton.modules.felix" default="netbeans" basedir=".">
<description>Builds, tests, and runs the project de.eppleton.modules.felix.</description>
<import file="nbproject/build-impl.xml"/>
<target name="run-felix">
<echo message="${felix.install.dir}"/>
<java classname="org.apache.felix.main.Main">
<sysproperty key="org.osgi.service.http.port" value="1234"/>
<classpath>
<pathelement location="${felix.install.dir}/bin/felix.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
</project>