WTPを使ったWebアプリケーションをビルド
- jarを作る
- warを作る
- どっかにデプロイ
をするantのスクリプト。
build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="daipresens_build" basedir=".">
<property file="build.properties" />
<target name="init">
<mkdir dir="${temp.dir}"/>
<delete>
<fileset dir="${temp.dir}"></fileset>
</delete>
<mkdir dir="${temp.src.dir}"/>
<mkdir dir="${temp.classes.dir}"/>
<mkdir dir="${temp.lib.dir}"/>
<mkdir dir="${temp.war.dir}"/>
</target>
<target name="makejar">
<copy todir="${temp.src.dir}">
<fileset dir="${app.src.dir}">
<exclude name="${copy.exclude}" />
</fileset>
</copy>
<delete includeemptydirs="true">
<fileset dir="${temp.src.dir}" includes="${copy.exclude}" />
</delete>
<javac srcdir="${temp.src.dir}" destdir="${temp.classes.dir}" encoding="UTF-8" classpath="${classes.dir}">
<classpath>
<pathelement path="" />
<fileset dir="${app.lib.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
<jar destfile="${temp.lib.dir}/${jar.name}" basedir="${temp.classes.dir}" />
</target>
<target name="makewar">
<copy file="${temp.lib.dir}/${jar.name}" todir="${app.lib.dir}"></copy>
<war destfile="${temp.war.dir}/${war.name}" webxml="${app.web.xml}">
<fileset dir="${app.dir}" excludes="**/web.xml" />
</war>
</target>
<target name="deploy">
<copy file="${temp.war.dir}/${war.name}" todir="${deploy.dir}"></copy>
</target>
</project>
build.properties
project.root=D:/daipresents/project/struts135
ant.dir=${project.root}/ant
temp.dir=${ant.dir}/temp
temp.src.dir=${temp.dir}/src
temp.classes.dir=${temp.dir}/classes
temp.lib.dir=${temp.dir}/lib
temp.war.dir=${temp.dir}/war
copy.exclude=**/test/**
app.name=struts135
app.dir=${project.root}/WebContent
app.src.dir=${project.root}/src
app.lib.dir=${app.dir}/WEB-INF/lib
app.web.xml=${app.dir}/WEB-INF/web.xml
classes.dir=${app.dir}/WEB-INF/classes;C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/servlet-api.jar
jar.name=struts135.jar
war.name=struts134.war
deploy.dir=C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps