用Ant将web工程打包

<?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="dist" name="sso">
    <property name="build.dir" value="web" description="输出目录"/>
	<property name="build.web.dir" value="${build.dir}/WEB-INF" description="web配置输出目录"/>
	<property name="build.web.class.dir" value="${build.web.dir}/classes" description="web类输出目录"/>
	<property name="build.web.lib.dir" value="${build.web.dir}/lib" description="web引用jar输出目录"/>
	<property name="src.dir" value="src/main/java" description="源代码目录"/>
	<property name="web.dir" value="${basedir}/web" />
	<property name="lib.dir" value="${web.dir}/WEB-INF/lib"/>
	<property name="dist.dir" value="dist" description="生成war包目录"/>
	
	<property name="TOMCAT_HOME" value="D:/Tools/apache-tomcat-6.0.44"/>
	<property name="ECLIPSE_HOME" value="D:/Tools/eclipse-jee-juno-win32/eclipse"/>
	
	<!-- 项目名称 -->
	<property name="webapp" value="${webapp.name}"/>
	
	<property name="encoding" value="utf-8" description="文件编码"/>
	<property name="target" value="1.6"/>
	<property name="source" value="1.6"/>
	
	<path id="buildpath">
        <fileset dir="D:/java/jdk1.6.0_17">
            <include name="**/*.jar"/>
        </fileset>
	</path>
	
	<path id="project.classpath">
		<fileset dir="${lib.dir}">
			<include name="*.jar"/>
		</fileset>
		<pathelement path="${basedir}/web/WEB-INF/lib"/>
		<pathelement location="web/WEB-INF/classes"/>
        <pathelement location="${TOMCAT_HOME}/lib/servlet-api.jar"/>
        <pathelement location="${TOMCAT_HOME}/lib/jasper.jar"/>
        <pathelement location="${TOMCAT_HOME}/lib/jsp-api.jar"/>
        <pathelement location="${TOMCAT_HOME}/lib/el-api.jar"/>
        <pathelement location="${TOMCAT_HOME}/lib/annotations-api.jar"/>
        <pathelement location="web/WEB-INF/lib/activation-1.1.jar"/>
        <pathelement location="web/WEB-INF/lib/antlr-2.7.6.jar"/>
        <pathelement location="web/WEB-INF/lib/aopalliance-1.0.jar"/>
        <pathelement location="web/WEB-INF/lib/aspectjrt-1.6.10.jar"/>
        <pathelement location="web/WEB-INF/lib/aspectjweaver-1.6.10.jar"/>
        <pathelement location="web/WEB-INF/lib/cas-client-core-3.1.10.jar"/>
        <pathelement location="web/WEB-INF/lib/cas-server-core-3.4.10.jar"/>
        <pathelement location="web/WEB-INF/lib/commons-codec-1.4.jar"/>
        <pathelement location="web/WEB-INF/lib/commons-collections-3.2.1.jar"/>
        <pathelement location="web/WEB-INF/lib/commons-io-2.0.jar"/>
        <pathelement location="web/WEB-INF/lib/commons-jexl-1.1.jar"/>
        <pathelement location="web/WEB-INF/lib/commons-lang-2.5.jar"/>
        <pathelement location="web/WEB-INF/lib/dom4j-1.6.1.jar"/>
        <pathelement location="web/WEB-INF/lib/hibernate-commons-annotations-3.2.0.Final.jar"/>
        <pathelement location="web/WEB-INF/lib/hibernate-core-3.6.0.Final.jar"/>
        <pathelement location="web/WEB-INF/lib/hibernate-jpa-2.0-api-1.0.0.Final.jar"/>
        <pathelement location="web/WEB-INF/lib/hibernate-validator-4.0.2.GA.jar"/>
        <pathelement location="web/WEB-INF/lib/inspektr-audit-1.0.4.GA.jar"/>
        <pathelement location="web/WEB-INF/lib/inspektr-common-1.0.4.GA.jar"/>
        <pathelement location="web/WEB-INF/lib/inspektr-error-1.0.4.GA.jar"/>
        <pathelement location="web/WEB-INF/lib/inspektr-support-spring-1.0.4.GA.jar"/>
        <pathelement location="web/WEB-INF/lib/javassist-3.7.ga.jar"/>
        <pathelement location="web/WEB-INF/lib/jaxb-api-2.1.jar"/>
        <pathelement location="web/WEB-INF/lib/jaxb-impl-2.1.3.jar"/>
        <pathelement location="web/WEB-INF/lib/jcl-over-slf4j-1.5.8.jar"/>
        <pathelement location="web/WEB-INF/lib/jdom-1.0.jar"/>
        <pathelement location="web/WEB-INF/lib/jstl-1.1.2.jar"/>
        <pathelement location="web/WEB-INF/lib/jta-1.1.jar"/>
        <pathelement location="web/WEB-INF/lib/log4j-1.2.15.jar"/>
        <pathelement location="web/WEB-INF/lib/ognl-2.7.3.jar"/>
        <pathelement location="web/WEB-INF/lib/opensaml-1.1b.jar"/>
        <pathelement location="web/WEB-INF/lib/perf4j-0.9.14-log4jonly.jar"/>
        <pathelement location="web/WEB-INF/lib/person-directory-api-1.5.0-RC6.jar"/>
        <pathelement location="web/WEB-INF/lib/person-directory-impl-1.5.0-RC6.jar"/>
        <pathelement location="web/WEB-INF/lib/quartz-1.6.1.jar"/>
        <pathelement location="web/WEB-INF/lib/slf4j-api-1.5.8.jar"/>
        <pathelement location="web/WEB-INF/lib/slf4j-log4j12-1.5.8.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-aop-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-asm-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-beans-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-binding-2.2.1.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-context-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-context-support-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-core-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-expression-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-jdbc-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-js-2.2.1.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-js-resources-2.2.1.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-orm-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-security-cas-client-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-security-config-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-security-core-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-security-web-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-tx-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-web-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-webflow-2.2.1.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-webmvc-3.0.5.RELEASE.jar"/>
        <pathelement location="web/WEB-INF/lib/standard-1.1.2.jar"/>
        <pathelement location="web/WEB-INF/lib/stax-api-1.0-2.jar"/>
        <pathelement location="web/WEB-INF/lib/validation-api-1.0.0.GA.jar"/>
        <pathelement location="web/WEB-INF/lib/xmldsig-1.0.jar"/>
        <pathelement location="web/WEB-INF/lib/xmlsec-1.4.3.jar"/>
        <pathelement location="web/WEB-INF/lib/cas-server-support-ldap-3.4.10.jar"/>
        <pathelement location="web/WEB-INF/lib/commons-dbcp.jar"/>
        <pathelement location="web/WEB-INF/lib/mysql-connector-5.1.8.jar"/>
        <pathelement location="web/WEB-INF/lib/ojdbc14.jar"/>
        <pathelement location="web/WEB-INF/lib/cas-server-integration-memcached-3.5.0.jar"/>
        <pathelement location="web/WEB-INF/lib/commons-pool-1.5.4.jar"/>
        <pathelement location="web/WEB-INF/lib/spring-ldap-1.3.1.RELEASE-all.jar"/>
        <pathelement location="web/WEB-INF/lib/spymemcached-2.8.1.jar"/>
	</path>
	
	<target name="init" description="清理dist文件夹中的原有war包">
		<delete dir="${dist.dir}" failοnerrοr="false" deleteonexit="true" excludes="**/lib"/>
	</target>
	
	<target name="compile" depends="init">
		<buildnumber/>
		<echo>compile ${build.dir} ......</echo>
		<javac destdir="${build.web.class.dir}" source="1.6" target="1.6" debug="on" 
			deprecation="false" optimize="false" failοnerrοr="true" includeantruntime="false" memoryinitialsize="512m" srcdir="${src.dir}">
			<compilerarg line="-encoding UTF-8"/>
			<classpath refid="project.classpath"></classpath>
		</javac>
		
		<copy todir="${build.web.class.dir}">
			<!-- 复制源代码目录中所有的非java文件 -->
			<fileset dir="${src.dir}" excludes="**/*.java"></fileset>
		</copy>
	</target>
	
	<target name="main" depends="compile"/>
	<target name="dist" depends="main" description="将工程打成war包">
		<war destfile="${dist.dir}/${ant.project.name}.war" basedir="${build.dir}" webxml="${build.web.dir}/web.xml"/>
	</target>
	
</project>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值