More than one filesets for jar : Jar « Ant « Java






More than one filesets for jar

 

<!--
  About this file (build.xml):

  Last modified 2001-11-30
  Author        Matthias Beil
  Contributor   Guillaume Desnoix
  License       GNU General Public License 2 (GPL2)
                Copyright (c) 2001 Matthias Beil
                All rights reserved.
-->

<!--  -->

<project name="alma" default="main" basedir="." >


<!--  -->
<!-- Set up application values -->

<property name="app.name"    value="alma" />
<property name="app.package" value="com/memoire" />
<property name="app.version" value="0.36" />
<property name="app.year"    value="2001" />


<!--  -->
<!-- directory locations -->

<property name="dir.classes"        location="classes" />
<property name="dir.dist"           location="dist" />

<property name="dir.javadocs"       location="docs" />
<property name="dir.project"        location="." />
<property name="dir.src"            location="." />

<property name="dir.package" value="com/memoire" />

<!-- debug setting -->
<property name="debug" value="on"/>

<!-- javadoc package -->
<property name="packages" value="com.memoire.*"/>


<!--  -->
<!-- Show System JVM -->

<target name="showsystem" >
   <!-- might not work!? -->
   <showsystem />
</target>



<!-- Create necessary directories -->

<target name="prepare">
   <tstamp />

   <mkdir dir="${dir.classes}" />
   <mkdir dir="${dir.dist}" />

</target>



<!-- Compiles the java source files -->

<target name="compile" depends="prepare">

   <javac
      srcdir="${dir.src}"
      destdir="${dir.classes}"
      classpath="${dir.src}"
      debug="${debug}"
      failonerror="no" >

      <include name="com/memoire/acme/Acme*.java"/>
      <include name="com/memoire/re/RE*.java"/>
      <include name="com/memoire/mst/Mst*.java"/>
      <include name="com/memoire/pbc/Pbc*.java"/>
      <include name="com/memoire/fu/Fu*.java"/>
      <include name="com/memoire/dnd/Dnd*.java"/>
      <include name="com/memoire/xml/Xml*.java"/>
      <include name="com/memoire/yapod/Yapod*.java"/>
      <include name="com/memoire/bu/Bu*.java"/>
      <include name="com/memoire/dja/Dja*.java"/>
      <include name="com/memoire/agl/Agl*.java"/>
      <include name="com/memoire/alma/Alma*.java"/>
      <include name="com/memoire/jedit/JEdit*.java"/>
      <include name="com/memoire/editor/Editor*.java"/>
      <include name="com/memoire/foo/Foo*.java"/>
      <include name="com/memoire/silk/Silk*.java"/>
      <include name="com/memoire/script/Script*.java"/>

      <exclude name="com/memoire/ant/*.java"/>
      <exclude name="com/memoire/editor/EditorJext.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterBeanshell.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterDawn.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterFiji.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterFoo.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterPnuts.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterPython.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterRhino.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterRuby.java"/>

   </javac>

</target>



<!-- Creates the jar file for distribution -->

<target name="dist" depends="compile">

   <jar jarfile="${dir.dist}/${app.name}.jar"
        manifest="manifest-alma.txt" >
      <fileset dir="${dir.classes}" >
         <patternset>
            <exclude name="**/dependency cache"/>
         </patternset>
      </fileset>
      <fileset dir="${dir.src}" >
         <patternset>
            <include name="**/*.dja"/>
            <include name="**/*.foo"/>
            <include name="**/*.gif"/>
            <include name="**/*.txt"/>
         </patternset>
      </fileset>

   </jar>

</target>



<!-- Compile and build a distribution -->

<target name="main" depends="compile, dist" >

   <echo>Alma application package created</echo>

</target>



<!-- Create the API documentation -->

<target name="javadocs" depends="prepare">
   <mkdir dir="${dir.javadocs}"/>

   <javadoc packagenames="${packages}"
            sourcepath="${dir.src}"
            destdir="${dir.javadocs}"
            classpath="${dir.src}"
            author="true"
            version="true"
            use="true"
            windowtitle="${app.name} API"
            doctitle="&lt;h1&gt;${app.name}&lt;/h1&gt;"
   />

</target>



<!-- Deletes the build and dist directories -->

<target name="clean" >

   <delete dir="${dir.dist}" />
   <delete dir="${dir.classes}" />

</target>




<target name="all" depends="clean,main,javadocs" >

   <echo>Alma application package cleaned and created</echo>

</target>



<!-- run application -->

<target name="app-run" depends="main" >
   <java classname="com.memoire.alma.Alma"
      classpath="${dir.dist}/${app.name}.jar"
      fork="yes">
   </java>
</target>

<target name="run-alma" depends="main" >
   <java classname="com.memoire.alma.Alma"
      classpath="${dir.dist}/${app.name}.jar"
      fork="yes">
   </java>
</target>

<target name="run-dja" depends="main" >
   <java classname="com.memoire.dja.Dja"
      classpath="${dir.dist}/${app.name}.jar"
      fork="yes">
   </java>
</target>

<target name="run-agl" depends="main" >
   <java classname="com.memoire.agl.Agl"
      classpath="${dir.dist}/${app.name}.jar"
      fork="no">
   </java>
</target>

<target name="run-foo" depends="main" >
   <java classname="com.memoire.foo.Foo"
      classpath="${dir.dist}/${app.name}.jar"
      fork="no">
   </java>
</target>

<target name="run-reformatage" depends="main" >
   <java classname="com.memoire.agl.AglOutilReformatage"
      classpath="${dir.dist}/${app.name}.jar"
      fork="no">
   </java>
</target>

<target name="run-coloration" depends="main" >
   <java classname="com.memoire.agl.AglOutilColoration"
      classpath="${dir.dist}/${app.name}.jar"
      fork="no">
   </java>
</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 with fileset and exclude
7.Jar file: exclude files
8.Add attribute to jar file manifest