Created
September 15, 2012 17:46
-
-
Save fcarriedo/3729022 to your computer and use it in GitHub Desktop.
Basic ant files for web and lib projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
Created: March 23 2010 | |
Comments: | |
A very basic ant file for lib projects. | |
--> | |
<project name="Estation Prototype" basedir="." default="jar"> | |
<property name="project.name" value="ivydemo"/> | |
<property name="src.dir" value="src"/> | |
<property name="lib.dir" value="lib"/> | |
<property name="build.dir" value="build"/> | |
<property name="dist.dir" value="dist"/> | |
<!-- Include all the jars under /lib --> | |
<path id="classpath"> | |
<fileset dir="${lib.dir}"> | |
<include name="**/*.jar" /> | |
</fileset> | |
</path> | |
<target name="init" depends="clean"> | |
<!-- Create the /build and /dist dirs --> | |
<mkdir dir="${build.dir}"/> | |
<mkdir dir="${dist.dir}"/> | |
</target> | |
<target name="clean"> | |
<!-- Delete the /build and /dist dirs --> | |
<delete dir="${build.dir}"/> | |
<delete dir="${dist.dir}"/> | |
</target> | |
<target name="compile" depends="init"> | |
<!-- Compile all the src and move the class files to WEB-INF/classes --> | |
<javac destdir="${build.dir}"> | |
<src path="${src.dir}"/> | |
<classpath refid="classpath"/> | |
</javac> | |
</target> | |
<target name="run" depends="jar"> | |
<java classname="com.ps.ivydemo.IvyDemo"> | |
<arg value=""/> | |
<classpath> | |
<pathelement path="${classpath}"/> | |
<pathelement path="${build.dir}/."/> | |
</classpath> | |
</java> | |
</target> | |
<target name="test" depends="compile"> | |
</target> | |
<target name="jar" depends="compile"> | |
<!-- Create a war from everything that resides on the /build dir --> | |
<jar destfile="${dist.dir}/${project.name}.jar"> | |
<fileset dir="${build.dir}"/> | |
</jar> | |
</target> | |
</project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
Created: March 23 2010 | |
Comments: | |
A very basic ant file for web projects. | |
--> | |
<project name="Estation Prototype" basedir="." default="war"> | |
<property name="project.name" value="estation"/> | |
<property name="src.dir" value="src"/> | |
<property name="web.dir" value="web"/> | |
<property name="lib.dir" value="lib"/> | |
<property name="build.dir" value="build"/> | |
<property name="dist.dir" value="dist"/> | |
<!-- Include all the jars under /lib --> | |
<path id="classpath"> | |
<fileset dir="${lib.dir}"> | |
<include name="**/*.jar" /> | |
</fileset> | |
</path> | |
<target name="init" depends="clean"> | |
<!-- Create the /build and /dist dirs --> | |
<mkdir dir="${build.dir}"/> | |
<mkdir dir="${dist.dir}"/> | |
</target> | |
<target name="clean"> | |
<!-- Delete the /build and /dist dirs --> | |
<delete dir="${build.dir}"/> | |
<delete dir="${dist.dir}"/> | |
</target> | |
<target name="compile" depends="init"> | |
<!-- Copy all the web dir contents to the /build dir --> | |
<copy todir="${build.dir}"> | |
<fileset dir="${web.dir}"/> | |
</copy> | |
<!-- Copy all the libraries to WEB-INF/lib --> | |
<copy todir="${build.dir}/WEB-INF/lib"> | |
<fileset dir="${lib.dir}"> | |
<exclude name="servlet-2.4.jar"/> | |
</fileset> | |
</copy> | |
<!-- Compile all the src and move the class files to WEB-INF/classes --> | |
<javac destdir="${build.dir}/WEB-INF/classes"> | |
<src path="${src.dir}"/> | |
<classpath refid="classpath"/> | |
</javac> | |
</target> | |
<target name="test" depends="compile"> | |
</target> | |
<target name="war" depends="compile"> | |
<!-- Create a war from everything that resides on the /build dir --> | |
<jar destfile="${dist.dir}/${project.name}.war"> | |
<fileset dir="${build.dir}"/> | |
</jar> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment