java - How to build a jar using an own MANIFEST.MF in Eclipse -
i have custom manifest.mf
in java-project in eclipse.
when exporting project jar, choose
use existing manifest workspace
extracting .jar shows eclipse generated own manifest.
my manifest:
manifest-version: 1.0 main-class: de.somehow.tagpdf.main class-path: lib/itext-5.0.2.jar;lib/jxl.jar;lib/jai_codec.jar;lib/jai_core.jar
how can fix this?
you can make use of build.xml build jar file you.
then run build.xml ant task.
see
if want build.xml run automatically every time build eclipse project, can add builders list.
see
below sample build.xml custom manifest used:
<?xml version="1.0" encoding="utf-8"?> <project basedir="." name="example" default="run_build"> <property name="guijar" value="../../library/<jar-name>.jar"></property> <target name="run_build" depends="delete_old_jar,create_dirs,create_manifest,copy_all_class_files,create_jar,delete_temp_dirs"> </target> <target name="delete_old_jar"> <delete file="${guijar}"> </delete> </target> <target name="create_dirs"> <mkdir dir="jar_temp" /> <mkdir dir="jar_temp/meta-inf" /> </target> <target name="delete_temp_dirs"> <delete dir="jar_temp"> </delete> </target> <target name="create_manifest"> <manifest file="jar_temp/meta-inf/manifest.mf"> <attribute name="manifest-version" value="1.0" /> <attribute name="version" value="1.0.0" /> <attribute name="company" value="value" /> <attribute name="project" value="value" /> <attribute name="java-version" value="${java.version}" /> <attribute name="class-path" value="test.jar" /> <attribute name="main-class" value="com.main" /> </manifest> </target> <target name="create_jar"> <jar destfile="${guijar}" manifest="jar_temp/meta-inf/manifest.mf" basedir="jar_temp"> </jar> </target> <target name="copy_all_class_files"> <copy todir="jar_temp"> <fileset dir="classes"> <include name="*/**" /> </fileset> </copy> </target> </project>
Comments
Post a Comment