Created
October 13, 2011 19:46
-
-
Save dmcrodrigues/1285303 to your computer and use it in GitHub Desktop.
ant file to build and deploy java Web Apps [tested on Apache Tomcat]
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" ?> | |
<project default="build"> | |
<property file="default.properties" /> | |
<property name="src" location="src" /> | |
<property name="root" location="WebContent" /> | |
<property name="lib" location="lib" /> | |
<property name="build" location="webapp" /> | |
<path id="compile.classpath"> | |
<fileset dir="${lib}"> | |
<include name="*.jar" /> | |
</fileset> | |
</path> | |
<target name="clean"> | |
<delete dir="${root}/WEB-INF/lib" /> | |
<delete dir="${root}/WEB-INF/classes" /> | |
<delete dir="${build}" /> | |
</target> | |
<target name="init" depends="clean"> | |
<mkdir dir="${root}/WEB-INF/lib" /> | |
<mkdir dir="${root}/WEB-INF/classes" /> | |
<mkdir dir="${build}" /> | |
</target> | |
<target name="compile" depends="init"> | |
<javac srcdir="${src}" destdir="${root}/WEB-INF/classes"> | |
<classpath refid="compile.classpath" /> | |
</javac> | |
</target> | |
<target name="build" depends="compile"> | |
<war destfile="${build}/${project.name}.war" webxml="${root}/WEB-INF/web.xml"> | |
<fileset dir="${root}" /> | |
<lib dir="${root}/WEB-INF/lib" /> | |
<classes dir="${root}/WEB-INF/classes" /> | |
</war> | |
</target> | |
<target name="deploy" depends="build"> | |
<copy file="${build}/${project.name}.war" tofile="${webserver.location}/webapps/${project.name}.war" overwrite="true" /> | |
</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
webserver.location=PATH_TO_SERVER | |
project.name=PROJECT_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment