I am trying to to build a Felix bundle in Eclipse. This basically includes having Eclipse create a JAR (through export) and adding my custom manifest file, however, I can't seem to get this to work. When I try exporting a JAR file, my custom manifest file shows up in the JAR, but doesn't ever get added to the right location within the JAR (meta-inf). This causes another default manifest file, which is created by Eclipse, to be added to my JAR file.
Note: I am using Eclipse's built in JAR export tool and selecting the option to use an existing manifest file from my workspace.
I'm sure there is some small detail being overlooked, but I am a little stumped.
Thanks for your help.
See Java Course - Creating a Java Application with Eclipse for doing it from UI.
You could also run Ant's jar task from Eclipse.
<target name="jar" depends="compile">
<mkdir dir="${jar.dest}" />
<jar
manifest="manifest.txt"
jarfile="${build.jar}"
basedir="${build.dest}">
</jar>
</target>
Edit: For OSGi bundles, there's Bnd, the bundle tool by Peter Kriens. That'll generate manifest and build jar for you. The tool is capable as acting as command line tool as well as Ant, Maven, and Eclipse plugin.
IF you use the Maven plugin (m2clipse), you can precise the manifest file in the maven configuration file of your project (pom.xml), in the "build section".
The manifest file will be added to the jar when you build it with maven (goal "mvn package").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With