ant创建web project!

build.xml 写道
<?xml version="1.0"?>
<project name="Example Application Build" default="compile" basedir=".">

<property file="build.properties" />

<target name="dir" description="Create the working directories">
<echo message="Creating the working directories"/>
<mkdir dir="${target}" />
<mkdir dir="${build}" />
<!--build the web file structs-->
<mkdir dir="${build.web}" />
<mkdir dir="${build.web.classes}" />
<mkdir dir="${build.web.lib}" />
<mkdir dir="${build.web.resources}" />
</target>

<path id="apps-classpath">
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
</path>

<target name="copy-runtime-jar">
<echo message="copy runtime-jar" />
<copy todir="${build.web.lib}">
<fileset dir="${lib}">
<exclude name="servlet-api.jar" />
<exclude name="jsp-api.jar" />
<exclude name="junit-4.8.1.jar" />
</fileset>
</copy>
</target>

<target name="copy-resources">
<echo message="copy resources file" />
<copy todir="${build.web}/WEB-INF/">
<fileset dir="${src.main}">
<exclude name="java/" />
<exclude name="*.class,*.java" />
<exclude name="classes/" />
</fileset>
</copy>
</target>

<target name="copy-webfile">
<echo message="copy web project file" />
<copy todir="${build.web}">
<fileset dir="${webfolder}">
<!--advise using relative path-->
<exclude name="WEB-INF/lib/" />
<exclude name="WEB-INF/classes/" />
</fileset>
</copy>
</target>

<target name="compile" depends="dir" description="compile the java code">
<echo message="+=============================================+"/>
<echo message="| JAVA Compile |"/>
<echo message="+=============================================+"/>
<javac destdir="${build.web.classes}">
<src path="${src.main}" />
<classpath refid="apps-classpath" />
</javac>
</target>

<target name="war" depends="compile">
<echo message="+=============================================+"/>
<echo message="| Web Application War |"/>
<echo message="+=============================================+"/>

<antcall target = "copy-webfile" />
<antcall target = "copy-resources" />
<antcall target = "copy-runtime-jar" />

<delete file="${target}/${webProject}.war"/>
<war destfile="${target}/${webProject}.war">
<fileset dir="${build}">
</fileset>
</war>
<!--
<delete file="${build.web}/" />
-->
</target>

<target name="clean" description="clean the dist working directories">
<echo message="clean the working directories"/>
<delete dir="${build}" />
<delete dir="${target}" />
</target>


<!--

<property name="cvsroot"
value=":pserver:[email protected]:/usr/local/cvsroot" />

<target name="checkout-oracle" depends="dir" description="checkout the oracle.jar">
<echo message="Checking out the required servlet sources from CVS" />
<cvs cvsroot="${cvsroot}" quiet="true" command="checkout -P {build}"
dest="${build}" compression="true" />
</target>
-->

</project>
build.properties

project=

antWebProject

webProject=

antWebProject

project.home =

.

 

build =

build

build.dist =

${build}/dist

target =

target

build.web =

${build}/${project.home}

build.web.classes =

${build.web}/WEB-INF/classes

build.web.lib =

${build.web}/WEB-INF/lib

 

build.web.resources =

${build.web}/WEB-INF/resources

 

src =

src

src.main =

${src}/main

src.main.resources=

${src.main}/resources

 

webfolder =

WebContent

webfolder.lib =

${webfolder}/WEB-INF/lib

webfolder.classes =

${webfolder}/WEB-INF/classes

 

你可能感兴趣的:(oracle,Web,ant,servlet,cvs)