Jar file: exclude files : Jar « Ant « Java

Jar file: exclude files

<?xml version="1.0"?>

<project name="yourname" basedir=".." default="all">

  <property name="dist" location="dist/"/> 
  <property name="lib" location="lib/"/> 
  <property name="src" location="src/"/> 

  <path id="class.path">
    <pathelement path="${src}"/> 
    <fileset dir="${lib}">
      <include name="**/*.jar"/>
      <include name="**/*.zip"/>
    <fileset dir="/dev">
      <include name="**/*.jar"/>
      <include name="**/*.zip"/>
  <target name="clean">
      <fileset dir="${src}" includes="**/*.class"/>
    <delete dir="${dist}"/>
  <target name="zip" depends="clean">
    <mkdir dir="${dist}"/>
    <zip destfile="${dist}\actionServlet-${DSTAMP}${TSTAMP}.zip">
      <zipfileset dir=".">
        <exclude name="${dist}"/>

  <target name="compile">
      <src path="${src}" />
      <classpath refid="class.path"/> 
      <include name = "*/**" />

  <target name="jar" depends="compile">
    <mkdir dir="${dist}"/>

      excludes="**/*.java, *.mdb"

  <target name="all" depends="jar"/>



Related examples in the same category

1.Ant task: jar
2.Jar with includes and excludes using filesets
3.Jar with includes and excludes
4.Generates java2s.jar
5.Ant jar file setting the Main-Class
6.Jar file with fileset and exclude
7.More than one filesets for jar
8.Add attribute to jar file manifest