Jar file with fileset and exclude : Jar « Ant « Java






Jar file with fileset and exclude

 
<?xml version="1.0"?>

<!--
 -  build.xml file for LBS logics aMorph build process (for Ant Version 1.6)
 -
 -  (c) LBS logics MBT GmbH,
 -      Austria
 -      www.lbs-logics.com
 -
 - $Id: build.xml,v 1.1 2005/01/18 07:26:05 hanzz Exp $
 -->

<!--
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
-->

<project name="amorph"  default="build"  basedir=".">

  <!-- PH20050118: introduced ant build script, targets to come... -->
  
  <!-- The classpath to be used to compile the project -->
  <path id="base.classpath">
    <fileset dir="lib">
      <include name="**/*.jar"/>
    </fileset>
  </path>
  
  <target name="init">
    <mkdir dir="build" />
    <mkdir dir="build/classes"/>
  </target>
  
  <target name="compile">
    <javac srcdir="src" destdir="build/classes">
      <classpath refid="base.classpath" />
    </javac>
  </target>
  
  <target name="build" description="compiles and packs the project" depends="init,compile">
    <jar destfile="build/amorph.jar"
           basedir="build/classes"  >
      <fileset dir=".">
        <exclude name="build/**/*.*"/>
        <exclude name=".classpath"/>
        <exclude name=".project"/>
        <exclude name="bin/**/*.*"/>
      </fileset>
    </jar>  
  </target>

</project>

   
  








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: exclude files
7.More than one filesets for jar
8.Add attribute to jar file manifest