Ant Build.xml to compile java code with external jars

<?xml version="1.0" encoding="UTF-8" ?><project name="OnlineProductManagement" basedir="/Users/mohan/IdeaProjects/Java/" default="build" >    <property name="src" location="src/main/java"/>    <property name="webapp" location="webapp/ROOT/webINF"/>    <property name="ext-jar" location="jars"/>    <property name="dest" location="${webapp}/classes"/>    <property name="jar" location="${webapp}/jar/"/>    <path id="build.classpath">        <fileset dir="${ext-jar}">            <include name="*.jar"/>        </fileset>    </path>
    <target name="clean" >           <delete dir="webapp"/>        </target>    <target name="compile" depends="clean" >            <mkdir dir="${dest}"/>            <mkdir dir="${jar}"/>            <javac srcdir="${src}" destdir="${dest}" includeantruntime="false" classpathref="build.classpath"/>
        </target>      <target name="jar" depends="compile">          <jar destfile="${jar}/Final.jar" basedir="${dest}">              <manifest>                  <attribute name="Main-Class" value="main.java.ProductDependencies"/>                  <attribute name="Class-Path" value="."/>               </manifest>                <zipgroupfileset excludes="META-INF" dir="${ext-jar}"/>          </jar>    </target>    <target name="build" depends="jar">        <java jar="${jar}/Final.jar" fork="true">            <classpath path="build.classpath"/>        </java>    </target></project>

Comments

Post a Comment

Popular posts from this blog

How whatsapp works

Android N Developer Preview? It's exciting for most of you