build.xml

<?xml version="1.0"?>

<project name="2demo" default="default" basedir="D:/2demo/2demo">
<!--// project directories //-->
<property name="dir.project" value="D:/2demo/2demo" />
<property name="dir.project.src" value="${dir.project}/src" />
<property name="dir.project.lib" value="${dir.project}/lib" />
<property name="dir.project.web_module" value="${dir.project}/WebContent" />
<property name="dir.project.web_module_lib" value="${dir.project}/lib" />

<!--// compile, build and deploy directories //-->
<property name="dir.project.build" value="${dir.project}/ant-build" />
<property name="dir.project.build.class" value="${dir.project.build}/classes" />
<property name="dir.project.build.web_module" value="${dir.project.build}/web" />
<property name="dir.project.build.web_module_class"
          value="${dir.project.build.web_module}/WEB-INF/classes" />

<!--// J2EE Container //-->
<property name="dir.appserver.tomcat.home" value="D:\e\soft\apache-tomcat-6.0.18\apache-tomcat-6.0.18" />
<property name="opt.compile.source" value="1.5" />
<property name="opt.compile.target" value="1.5" />
<property name="opt.compile.encoding" value="utf-8" />
<property name="opt.compile.deprecation" value="on" />
<property name="opt.compile.debug" value="on" />
<property name="opt.compile.optimize" value="on" />
<!--// Web Module Name //-->
<property name="deploy.file.web_module" value="2demo" />
<path id="CLASSPATH">
<!--// Tomcat Libraries //-->
<fileset dir="${dir.appserver.tomcat.home}/bin">
<include name="*.jar" />
</fileset>
<fileset dir="${dir.appserver.tomcat.home}/lib">
<include name="*.jar" />
</fileset>
<!--
<fileset dir="${dir.appserver.tomcat.home}/common/lib">
<include name="*.jar" />
</fileset>
-->
<!--// Depended Libraries //-->
<fileset dir="${dir.project.web_module_lib}">
<include name="*.jar" />
</fileset>

<fileset dir="${dir.project.lib}">
<include name="**/*.jar" />
</fileset>

<!--// Project classes //-->
<pathelement location="${dir.project.build.class}" />
</path>
<target name="clean">
<!--<delete dir="${dir.project.build}" />-->
<delete dir="${dir.project.build.web_module}" />
<delete dir="${dir.project.build.class}" />
</target>

<target name="init">
<mkdir dir="${dir.project.build}" />
<mkdir dir="${dir.project.build.class}" />
</target>
<target name="compile" depends="init">
<!--// compile the Java source //-->
<javac srcdir="${dir.project.src}" destdir="${dir.project.build.class}" debug="${opt.compile.debug}" memorymaximumsize="1024M" fork="true" optimize="${opt.compile.optimize}">
<compilerarg value="-Xlint:unchecked" line="-encoding UTF-8 "/>
<classpath refid="CLASSPATH" />
<include name="**/*.java" />
</javac>
<!--// copy the classpath resources //-->
<copy todir="${dir.project.build.class}">
<fileset dir="${dir.project.src}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<target name="build" depends="clean, init, compile">
<copy todir="${dir.project.build.web_module}">
<fileset dir="${dir.project.web_module}">
<include name="**" />
</fileset>
</copy>

<copy todir="${dir.project.build.class}">
<fileset dir="${dir.project.web_module}/WEB-INF/">
<include name="**" />
</fileset>
</copy>

<copy todir="${dir.project.build.web_module_class}">
<fileset dir="${dir.project.build.class}">
<include name="**" />
</fileset>
</copy>

<copy todir="${dir.project.build.web_module}/WEB-INF/lib">
<fileset dir="${dir.project.lib}">
<include name="**/*.jar" />
</fileset>
</copy>



</target>
<!--
<target name="replace">
<replace file="${dir.project.build.web_module_class}/jdbc.properties"
         token="jdbc.url=jdbc:oracle:thin:@192.168.100.89:1521:ismp"
         value="jdbc.url=jdbc:oracle:thin:@192.168.100.89:1521:ismp" />
<replace file="${dir.project.build.web_module_class}/placeholder.properties"
         token="logDir=../log"
         value="logDir=/data/tomcat/webapps/newchannelsoap/log/" />
<replace file="${dir.project.build.web_module_class}/service.properties"
         token="province_search_index_path=D:/Projects/mobileno"
         value="province_search_index_path=/data/mobileno" />
</target>
-->
<target name="war">
<war destfile="${dir.project.build}/${deploy.file.web_module}.war"
     webxml="${dir.project.build.web_module}/WEB-INF/web.xml">
<fileset dir="${dir.project.build.web_module}">
<include name="**" />
</fileset>
</war>
</target>
<target name="default" depends="build, war" />
</project>

你可能感兴趣的:(java,tomcat,Web,xml)