ant



-------------------------------build.properties
name=
tomcate.home=D:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps
tomcate.server=${jboss.home}/server/default
tomcate.deploy.dir=${jboss.server}/deploy
------------------------------------
-------------------------------build.properties
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="."  name="SSHDemo">


<!-- ===================== Initialize Property Values ================ -->
<property file="${basedir}/build.properties"/>
<property name="web.dir" value="${basedir}/web"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="output.dir" value="${basedir}/build/output"/>
<property name="build.dir" value="${basedir}\build"/>

<!-- Compile options -->
<property name="debug" value="on"/>
<property name="deprecation" value="on"/>
<property name="optimize" value="on"/>
<property name="nowarn" value="on"/>




<path id="SSHDemo.classpath">
        <pathelement location="WebContent/WEB-INF/lib/antlr-2.7.2.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/bsf-2.3.0.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-beanutils-1.7.0.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-chain-1.1.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-digester-1.8.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-io-1.1.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-logging-1.0.4.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-validator-1.3.1.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/jstl-1.0.2.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/oro-2.0.8.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/servlet-2_5-api.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/standard-1.0.2.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-core-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-el-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-extras-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-faces-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-scripting-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-taglib-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-tiles-1.3.9.jar"/>
    </path>



<target name="prepare">
<delete dir="${build.dir}" />
<mkdir dir="${build.dir}" />
</target>

<target name="compile" depends="prepare" description="编译">
<javac srcdir="${src.dir}" destdir="${build.dir}">
<classpath refid="SSHDemo.classpath" />
</javac>
</target>

</project>
-------------------------------------build.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
              Any modifications will be overwritten.
              To include a user specific buildfile here, simply create one in the same
              directory with the processing instruction <?eclipse.ant.import?>
              as the first entry and export the buildfile again. -->
<project basedir="." default="build" name="SSHDemo">
    <property environment="env"/>
    <property name="ECLIPSE_HOME" value="../../IDE for JEE/eclipse"/>
    <property name="debuglevel" value="source,lines,vars"/>
    <property name="target" value="1.6"/>
    <property name="source" value="1.6"/>
    <path id="Apache Tomcat v5.0 [Apache Tomcat ].libraryclasspath">
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/ant-launcher.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/ant.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/commons-collections-3.1.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/commons-dbcp-1.2.1.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/commons-el.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/commons-pool-1.2.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/jasper-compiler.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/jasper-runtime.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/jsp-api.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/naming-common.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/naming-factory.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/naming-java.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/naming-resources.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/servlet-api.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/tools.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/endorsed/xercesImpl.jar"/>
        <pathelement location="../../Program Files/Apache Software Foundation/Tomcat 5.0/common/endorsed/xml-apis.jar"/>
    </path>
    <path id="Web App Libraries.libraryclasspath">
        <pathelement location="WebContent/WEB-INF/lib/antlr-2.7.2.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/bsf-2.3.0.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-beanutils-1.7.0.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-chain-1.1.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-digester-1.8.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-io-1.1.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-logging-1.0.4.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-validator-1.3.1.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/jstl-1.0.2.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/oro-2.0.8.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/servlet-2_5-api.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/standard-1.0.2.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-core-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-el-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-extras-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-faces-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-scripting-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-taglib-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-tiles-1.3.9.jar"/>
    </path>
    <path id="EAR Libraries.libraryclasspath"/>
    <path id="SSHDemo.classpath">
        <pathelement location="build/classes"/>
        <path refid="Apache Tomcat v5.0 [Apache Tomcat ].libraryclasspath"/>
        <path refid="Web App Libraries.libraryclasspath"/>
        <path refid="EAR Libraries.libraryclasspath"/>
        <pathelement location="WebContent/WEB-INF/lib/antlr-2.7.2.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/bsf-2.3.0.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-beanutils-1.7.0.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-chain-1.1.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-digester-1.8.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-io-1.1.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-logging-1.0.4.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/commons-validator-1.3.1.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/jstl-1.0.2.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/oro-2.0.8.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/servlet-2_5-api.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/standard-1.0.2.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-core-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-el-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-extras-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-faces-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-mailreader-dao-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-scripting-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-taglib-1.3.9.jar"/>
        <pathelement location="WebContent/WEB-INF/lib/struts-tiles-1.3.9.jar"/>
    </path>
    <target name="init">
        <mkdir dir="build/classes"/>
        <copy includeemptydirs="false" todir="build/classes">
            <fileset dir="src">
                <exclude name="**/*.launch"/>
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
    </target>
    <target name="clean">
        <delete dir="build/classes"/>
    </target>
    <target depends="clean" name="cleanall"/>
    <target depends="build-subprojects,build-project" name="build"/>
    <target name="build-subprojects"/>
    <target depends="init" name="build-project">
        <echo message="${ant.project.name}: ${ant.file}"/>
        <javac debug="true" debuglevel="${debuglevel}" destdir="build/classes" source="${source}" target="${target}">
            <src path="src"/>
            <classpath refid="SSHDemo.classpath"/>
        </javac>
    </target>
    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
    <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
        <copy todir="${ant.library.dir}">
            <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
        </copy>
        <unzip dest="${ant.library.dir}">
            <patternset includes="jdtCompilerAdapter.jar"/>
            <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
        </unzip>
    </target>
    <target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
        <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
        <antcall target="build"/>
    </target>
</project>

-----------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>

<project name="redpoint" default="deploy" basedir=".">
<!-- ===================== Initialize Property Values ================ -->
<property file="${basedir}/build.properties"/>
<property name="web.dir" value="${basedir}/web"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="output.dir" value="${basedir}/build/output"/>

<!-- Compile options -->
<property name="debug" value="on"/>
<property name="deprecation" value="on"/>
<property name="optimize" value="on"/>
<property name="nowarn" value="on"/>

<!-- ==================== = Initialize classpath ======================= -->
<path id="base.classpath">
<fileset dir="${jboss.home}/client">
            <include name="**/*.jar"/>
        </fileset>
        <fileset dir="${jboss.server}/lib/">
            <include name="javax.servlet*.jar"/>
        <include name="*.jar"/>
        </fileset>
<fileset dir="${jboss.server}/deploy/jbossweb-tomcat55.sar">
<include name="*.jar"/>
</fileset>
</path>

<path id="web.classpath">
<path refid="base.classpath"/>
<fileset dir="${web.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
</path>

<path id="jspc.classpath">
<path refid="web.classpath"/>
<pathelement location="${java.home}/../lib/tools.jar"/>
<pathelement location="${output.dir}/classes"/>
</path>

<!-- ===================== Clean ===================================== -->
<target name="clean">
<echo message=""/>
<echo message="... cleanup ..."/>
<delete dir="${output.dir}"/>
</target>

<!-- ===================== Init ====================================== -->
<target name="init">
<echo message="Building: ${name}"/>
<echo message="Base dir: ${basedir}"/>
<echo message="jboss.home: ${jboss.home}"/>
<echo message="jboss.server: ${jboss.server}"/>
<echo message="jboss.deploy.dir: ${jboss.deploy.dir}"/>

<mkdir dir="${output.dir}/classes"/>
</target>

<!-- ===================== Compile =================================== -->
<target name="compile" depends="init">
<echo message=""/>
<echo message="*** compile ***"/>
<javac srcdir="${src.dir}" destdir="${output.dir}/classes"
debug="${debug}" deprecation="${deprecation}" optimize="${optimize}" nowarn="${nowarn}">
<classpath refid="web.classpath"/>
<include name="**/*.java"/>
</javac>
</target>

<target name="jspc2" depends="compile" if="compileJSP">
    <taskdef classname="org.apache.jasper.JspC" name="jasper2" >
      <classpath refid="jspc.classpath"/>
    </taskdef>
    <jasper2 validateXml="false"
             uriroot="${web.dir}"
             webXmlFragment="${output.dir}/tmp-jsp/WEB-INF/generated_web.xml"
             outputDir="${output.dir}/tmp-jsp/WEB-INF/src"/>
</target>

<!-- ===================== Jspc ====================================== -->
<target name="jspc" depends="compile" description="Compile Java-WEB File " if="jspc">
<!-- complie jsp -->
<echo message=""/>
<echo message="*** compile jsp ***"/>

<mkdir dir="${output.dir}/tmp-jsp"/>
<echo message=""/>
<echo message="*** compile jsp (templates) ***"/>
<jspc srcdir="${web.dir}/jsp"
destdir="${output.dir}/tmp-jsp"
verbose="1"
uriroot="${web.dir}">
<include name="**/templates/**/*.jsp"/>
<include name="**/*.jsp"/>
<exclude name="**/app/**/*Content.jsp"/>
<classpath refid="jspc.classpath"/>
</jspc>

<echo message=""/>
<echo message="*** compile jsp (contents) ***"/>
<jspc srcdir="${web.dir}/jsp"
destdir="${output.dir}/tmp-jsp"
verbose="1"
uriroot="${web.dir}">
<include name="**/app/**/*Content.jsp"/>
<classpath refid="jspc.classpath"/>
</jspc>

<echo message=""/>
<echo message="*** compile jsp ***"/>
<jspc srcdir="${web.dir}/jsp"
destdir="${output.dir}/tmp-jsp"
verbose="1"
uriroot="${web.dir}">
<include name="**/app/**/*.jsp"/>
<classpath refid="jspc.classpath"/>
</jspc>

<echo message=""/>
<echo message="*** compile generated java ***"/>
<javac srcdir="${output.dir}/tmp-jsp" destdir="${output.dir}/tmp-jsp"
debug="${debug}" deprecation="${deprecation}" optimize="${optimize}" nowarn="${nowarn}">
<classpath refid="jspc.classpath"/>
<include name="**/*.java"/>
</javac>

</target>

<!-- ===================== Package =================================== -->
<target name="package" depends="jspc2">
<!-- WAR -->
<echo message=""/>
<echo message="*** package WAR ***"/>
<delete dir="${output.dir}/WAR"/>
<mkdir dir="${output.dir}/WAR"/>

<antcall target="updateResources"/>

<war update="true" warfile="${output.dir}/${name}.war" webxml="${web.dir}/WEB-INF/web.xml">
<fileset dir="${web.dir}">
<include name="*.html"/>
<include name="*.htm"/>
<include name="*.jsp"/>
<include name="jsp/**"/>
<include name="images/**"/>
<include name="js/**"/>
<include name="vbs/**"/>
<include name="css/**"/>
<include name="prop/**"/>
<include name="log/**"/>
<include name="META-INF/**"/>
<include name="WEB-INF/tlds/**"/>
<exclude name="*CVS*"/>
<exclude name="**/Thumbs.db"/>
<exclude name="**/*.bak"/>
</fileset>

<zipfileset dir="${web.dir}/WEB-INF" prefix="WEB-INF">
<include name="jboss-web.xml"/>
<include name="struts-config.xml"/>
<include name="struts-config-app.xml"/>
</zipfileset>
<lib dir="${web.dir}/WEB-INF/lib" />
<classes dir="${output.dir}/classes">
<exclude name="*CVS*"/>
</classes>
<zipfileset dir="${src.dir}" prefix="WEB-INF/classes">
<include name="*.properties"/>
</zipfileset>
</war>
</target>

<target name="jspCompile">
<property name="jspc" value="on"/>
</target>

<!-- ===================== Deploy ==================================== -->
<target name="deploy" depends="package">
<!-- deploy -->
<echo message=""/>
<echo message="*** deploy ***"/>
<copy file="${output.dir}/${name}.war" todir="${jboss.deploy.dir}"/>
</target>

<!-- ===================== Deploy no jspc ==================================== -->
<target name="nojspc" depends="package">
<!-- deploy -->
<copy file="${output.dir}/${name}.war" todir="${jboss.deploy.dir}"/>
<echo message=""/>
<echo message="*** deploy ***"/>
</target>

<target name="checkResources">
<uptodate property="isResourcesUpdated">
<srcfiles dir="${basedir}/resources" includes="*.properties"/>
<mapper type="glob" from="*.properties" to="${output.dir}/classes/resources/*.properties"></mapper>
</uptodate>
</target>

<target name="updateResources" depends="checkResources" unless="isResourcesUpdated">
<echo message="Copying resource files from ${basedir} (Auto ASCII conversion)"/>
<delete dir="${output.dir}/classes/resources"/>
<native2ascii encoding="UTF-8" src="${basedir}/resources" dest="${output.dir}/classes/resources"
   includes="*.properties"/>
</target>

    <target name="delete jboss war">
    <delete file="${jboss.deploy.dir}/${name}.war"/>
    </target>

</project>
----------------------------------------------------------------




你可能感兴趣的:(eclipse,tomcat,xml,ant,jboss)