How to build jar using ant without META-INF folder? I have not specified any manifest attribute in:
<jar destfile="${build}/${jar}/${client}.jar" basedir="${build}/${classes}/${main}">
<fileset file="${src}/${main}/application-context.xml" />
<fileset file="${src}/${main}/log4j.xml" />
</jar>
But the jar file containing META-INF folder. Is there any way to exclude this folder's creation?
Edit:
The complete build.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
Aug 14, 2011 6:25:15 PM
Tanmoy
====================================================================== -->
<project name="Number">
<description>
Number
</description>
<property name="lib" value="lib" />
<property name="src" value="src" />
<property name="build" value="build" />
<property name="classes" value="classes" />
<property name="jar" value="jar" />
<property name="jarfilename" value="Number" />
<property name="client" value="client" />
<property name="main" value="main" />
<property name="loader" value="loader" />
<target name="clean">
<delete dir="${build}" />
</target>
<path id="classpath">
<fileset dir="${lib}" includes="*.jar" />
</path>
<target name="compile">
<delete dir="${lib}" />
<mkdir dir="${lib}" />
<copy file="C:\Users\Tanmoy\.m2\repository\org\swinglabs\swingx-core\1.6.2-2\swingx-core-1.6.2-2.jar" todir="${lib}" />
<copy file="C:\Users\Tanmoy\.m2\repository\org\springframework\spring-core\3.0.5.RELEASE\spring-core-3.0.5.RELEASE.jar" todir="${lib}" />
<copy file="C:\Users\Tanmoy\.m2\repository\org\springframework\spring-asm\3.0.5.RELEASE\spring-asm-3.0.5.RELEASE.jar" todir="${lib}" />
<copy file="C:\Users\Tanmoy\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar" todir="${lib}" />
<copy file="C:\Users\Tanmoy\.m2\repository\org\springframework\spring-context\3.0.5.RELEASE\spring-context-3.0.5.RELEASE.jar" todir="${lib}" />
<copy file="C:\Users\Tanmoy\.m2\repository\org\springframework\spring-aop\3.0.5.RELEASE\spring-aop-3.0.5.RELEASE.jar" todir="${lib}" />
<copy file="C:\Users\Tanmoy\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar" todir="${lib}" />
<copy file="C:\Users\Tanmoy\.m2\repository\org\springframework\spring-beans\3.0.5.RELEASE\spring-beans-3.0.5.RELEASE.jar" todir="${lib}" />
<copy file="C:\Users\Tanmoy\.m2\repository\org\springframework\spring-expression\3.0.5.RELEASE\spring-expression-3.0.5.RELEASE.jar" todir="${lib}" />
<copy file="C:\Users\Tanmoy\.m2\repository\log4j\apache-log4j-extras\1.0\apache-log4j-extras-1.0.jar" todir="${lib}" />
<copy file="C:\Users\Tanmoy\.m2\repository\log4j\log4j\1.2.9\log4j-1.2.9.jar" todir="${lib}" />
<copy file="F:\Number\Number\jars\dj-nativeswing-0.9.8.jar" todir="${lib}" />
<copy file="F:\Number\Number\jars\dj-nativeswing-swt-0.9.8.jar" todir="${lib}" />
<copy file="F:\Number\Number\jars\dj-swingsuite-0.9.1.jar" todir="${lib}" />
<copy file="F:\Number\Number\jars\swt-linux32-3.6.2.jar" todir="${lib}" />
<copy file="F:\Number\Number\jars\swt-linux64-3.6.2.jar" todir="${lib}" />
<copy file="F:\Number\Number\jars\swt-osx32-3.6.2.jar" todir="${lib}" />
<copy file="F:\Number\Number\jars\swt-osx64-3.6.2.jar" todir="${lib}" />
<copy file="F:\Number\Number\jars\swt-win32-3.6.2.jar" todir="${lib}" />
<copy file="F:\Number\Number\jars\swt-win64-3.6.2.jar" todir="${lib}" />
<mkdir dir="${build}/${classes}/${main}" />
<javac srcdir="${src}/${main}" destdir="${build}/${classes}/${main}" classpathref="classpath" />
<mkdir dir="${build}/${classes}/${loader}" />
<javac srcdir="${src}/${loader}" destdir="${build}/${classes}/${loader}" />
</target>
<target name="jar" depends="clean, compile">
<mkdir dir="${build}/${jar}" />
<jar destfile="${build}/${jar}/${client}.jar" basedir="${build}/${classes}/${main}">
<fileset file="${src}/${main}/application-context.xml" />
<fileset file="${src}/${main}/log4j.xml" />
</jar>
<jar destfile="${build}/${jar}/${jarfilename}.${jar}" basedir="${build}/${classes}/${loader}">
<manifest>
<attribute name="Main-Class" value="in.res.num.tpb.loader.ClientLoader" />
</manifest>
<fileset dir="${build}/${jar}" includes="${client}.jar" />
<fileset dir="${lib}" includes="*.jar" />
</jar>
<delete file="${build}/${jar}/${client}.jar" />
</target>
<target name="run" depends="clean, compile, jar">
<java jar="${build}/${jar}/${jarfilename}.${jar}" fork="true" />
</target>
</project>
Use zip
instead of jar
. Why do you want to avoid a META-INF folder?