4月 7th, 2008at 19:38

Tags: ,

ant1.6.1のwarタスク

このエントリーをはてなブックマークに追加

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/struts135ant.dir=${project.root}/ant

temp.dir=${ant.dir}/temptemp.src.dir=${temp.dir}/srctemp.classes.dir=${temp.dir}/classestemp.lib.dir=${temp.dir}/libtemp.war.dir=${temp.dir}/war

copy.exclude=**/test/**

app.name=struts135app.dir=${project.root}/WebContentapp.src.dir=${project.root}/srcapp.lib.dir=${app.dir}/WEB-INF/libapp.web.xml=${app.dir}/WEB-INF/web.xmlclasses.dir=${app.dir}/WEB-INF/classes;C:/Program Files/Apache Software  Foundation/Tomcat 5.5/common/lib/servlet-api.jar

jar.name=struts135.jarwar.name=struts134.war

deploy.dir=C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps
このエントリーをはてなブックマークに追加