`
- 浏览:
120698 次
-
先是build.properties
java 代码
- # Ant properties for building the springapp
-
- appserver.home=D:/tools/Tomcat 5.0
- deploy.path=${appserver.home}/webapps
-
- tomcat.manager.url=http:
- tomcat.manager.username=admin
- tomcat.manager.password=
- #db properties
- db.driver=com.mysql.jdbc.Driver
- db.url=jdbc:mysql:
- db.user=root
- db.pw=1234
然后是build.xml
xml 代码
- xml version="1.0" encoding="utf-8"?>
- <project name="springapp" basedir="." default="usage">
- <property file="build.properties"/>
- <property name="src.dir" value="src"/>
- <property name="web.dir" value="war"/>
- <property name="build.dir" value="${web.dir}/WEB-INF/classes"/>
- <property name="name" value="springapp"/>
- <path id="master-classpath">
- <fileset dir="${web.dir}/WEB-INF/lib">
- <include name="*.jar"/>
- <!---->fileset>
-
-
-
-
- <fileset dir="${appserver.home}/common/lib">
- <include name="servlet*.jar"/>
- <!---->fileset>
- <pathelement path="${build.dir}"/>
- <!---->path>
- <target name="usage">
- <echo message=""/>
- <echo message="${name} build file"/>
- <echo message="-----------------------------------"/>
- <echo message=""/>
- <echo message="Available targets are:"/>
- <echo message=""/>
- <echo message="build --> Build the application"/>
- <echo message="deploy --> Deploy application as directory"/>
- <echo message="deploywar --> Deploy application as a WAR file"/>
- <echo message="install --> Install application in Tomcat"/>
- <echo message="reload --> Reload application in Tomcat"/>
- <echo message="start --> Start Tomcat application"/>
- <echo message="undeploy --> undeploy Tomcat application"/>
- <echo message="clean --> clean classes "/>
- <echo message="stop --> Stop Tomcat application"/>
- <echo message="junit --> junit the applications"/>
- <echo message="list --> List Tomcat applications"/>
- <echo message=""/>
- <!---->target>
- <target name="build" description="Compile main source tree java files">
- <mkdir dir="${build.dir}"/>
- <javac destdir="${build.dir}" debug="true" deprecation="false" optimize="false" failonerror="true">
- <src path="${src.dir}"/>
- <classpath refid="master-classpath"/>
- <!---->javac>
- <!---->target>
- <target name="deploy" depends="build" description="Deploy application">
- <copy todir="${deploy.path}/${name}" preservelastmodified="true">
- <fileset dir="${web.dir}">
- <include name="**/*.*"/>
- <!---->fileset>
- <!---->copy>
- <!---->target>
- <target name="deploywar" depends="build" description="Deploy application as a WAR file">
- <war destfile="${name}.war" webxml="${web.dir}/WEB-INF/web.xml">
- <fileset dir="${web.dir}">
- <include name="**/*.*"/>
- <!---->fileset>
- <!---->war>
- <copy todir="${deploy.path}" preservelastmodified="true">
- <fileset dir=".">
- <include name="*.war"/>
- <!---->fileset>
- <!---->copy>
- <!---->target>
-
- <target name="clean" description="Clean output directories">
- <delete>
- <fileset dir="${build.dir}">
- <include name="**/*.class"/>
- <!---->fileset>
- <!---->delete>
- <!---->target>
-
- <target name="undeploy" description="Un-Deploy application">
- <delete>
- <fileset dir="${deploy.path}/${name}">
- <include name="**/*.*"/>
- <!---->fileset>
- <!---->delete>
- <!---->target>
-
- <target name="junit" depends="build,clearData,loadData" description="Run JUnit Tests">
- <junit printsummary="on"
- fork="false"
- haltonfailure="false"
- failureproperty="tests.failed"
- showoutput="true">
- <classpath refid="master-classpath"/>
- <formatter type="brief" usefile="false"/>
-
- <batchtest>
- <fileset dir="${build.dir}">
- <include name="**/Test*.*"/>
- <!---->fileset>
- <!---->batchtest>
-
- <!---->junit>
-
- <fail if="tests.failed">
- tests.failed=${tests.failed}
- ***********************************************************
- ***********************************************************
- **** One or more tests failed! Check the output ... ****
- ***********************************************************
- ***********************************************************
- <!---->fail>
- <!---->target>
-
-
- <target name="createTables">
- <echo message="CREATE TABLES USING: ${db.driver} ${db.url}"/>
- <sql driver="${db.driver}"
- url="${db.url}"
- userid="${db.user}"
- password="${db.pw}"
- onerror="continue">
- <classpath refid="master-classpath"/>
-
- CREATE TABLE products (
- id INTEGER NOT NULL PRIMARY KEY,
- description varchar(255),
- price decimal(15,2)
- );
- CREATE INDEX products_description ON products(description);
-
- <!---->sql>
- <!---->target>
-
- <target name="dropTables">
- <echo message="DROP TABLES USING: ${db.driver} ${db.url}"/>
- <sql driver="${db.driver}"
- url="${db.url}"
- userid="${db.user}"
- password="${db.pw}"
- onerror="continue">
- <classpath refid="master-classpath"/>
-
- DROP TABLE products;
-
- <!---->sql>
- <!---->target>
-
- <target name="loadData">
- <echo message="LOAD DATA USING: ${db.driver} ${db.url}"/>
- <sql driver="${db.driver}"
- url="${db.url}"
- userid="${db.user}"
- password="${db.pw}"
- onerror="continue">
- <classpath refid="master-classpath"/>
-
- INSERT INTO products (id, description, price) values(1, 'Lamp', 5.78);
- INSERT INTO products (id, description, price) values(2, 'Table', 75.29);
- INSERT INTO products (id, description, price) values(3, 'Chair', 22.81);
- COMMIT;
- <!---->sql>
- <!---->target>
-
- <target name="printData">
- <echo message="PRINT DATA USING: ${db.driver} ${db.url}"/>
- <sql driver="${db.driver}"
- url="${db.url}"
- userid="${db.user}"
- password="${db.pw}"
- onerror="continue"
- print="true">
- <classpath refid="master-classpath"/>
-
- SELECT * FROM products;
-
- <!---->sql>
- <!---->target>
-
- <target name="clearData">
- <echo message="CLEAR DATA USING: ${db.driver} ${db.url}"/>
- <sql driver="${db.driver}"
- url="${db.url}"
- userid="${db.user}"
- password="${db.pw}"
- onerror="continue">
- <classpath refid="master-classpath"/>
-
- DELETE FROM products;
-
- <!---->sql>
- <!---->target>
-
-
-
-
-
-
- <taskdef name="install" classname="org.apache.catalina.ant.InstallTask">
- <classpath>
- <path location="${appserver.home}/server/lib/catalina-ant.jar"/>
- <!---->classpath>
- <!---->taskdef>
- <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
- <classpath>
- <path location="${appserver.home}/server/lib/catalina-ant.jar"/>
- <!---->classpath>
- <!---->taskdef>
- <taskdef name="list" classname="org.apache.catalina.ant.ListTask">
- <classpath>
- <path location="${appserver.home}/server/lib/catalina-ant.jar"/>
- <!---->classpath>
- <!---->taskdef>
- <taskdef name="start" classname="org.apache.catalina.ant.StartTask">
- <classpath>
- <path location="${appserver.home}/server/lib/catalina-ant.jar"/>
- <!---->classpath>
- <!---->taskdef>
- <taskdef name="stop" classname="org.apache.catalina.ant.StopTask">
- <classpath>
- <path location="${appserver.home}/server/lib/catalina-ant.jar"/>
- <!---->classpath>
- <!---->taskdef>
- <target name="install" description="Install application in Tomcat">
- <install url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}" war="${name}"/>
- <!---->target>
- <target name="reload" description="Reload application in Tomcat">
- <reload url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}"/>
- <!---->target>
- <target name="start" description="Start Tomcat application">
- <start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}"/>
- <!---->targ
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
赠送原API文档:sentinel-spring-webmvc-adapter-1.8.0-javadoc.jar; 赠送源代码:sentinel-spring-webmvc-adapter-1.8.0-sources.jar; 赠送Maven依赖信息文件:sentinel-spring-webmvc-adapter-1.8.0.pom; 包含...
赠送原API文档:springfox-spring-webmvc-3.0.0-javadoc.jar; 赠送源代码:springfox-spring-webmvc-3.0.0-sources.jar; 赠送Maven依赖信息文件:springfox-spring-webmvc-3.0.0.pom; 包含翻译后的API文档:...
赠送原API文档:sentinel-spring-webmvc-adapter-1.8.0-javadoc.jar; 赠送源代码:sentinel-spring-webmvc-adapter-1.8.0-sources.jar; 赠送Maven依赖信息文件:sentinel-spring-webmvc-adapter-1.8.0.pom; 包含...
赠送原API文档:spring-webmvc-5.2.15.RELEASE-javadoc.jar; 赠送源代码:spring-webmvc-5.2.15.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-webmvc-5.2.15.RELEASE.pom; 包含翻译后的API文档:spring-...
赠送原API文档:spring-webmvc-5.3.7-javadoc.jar; 赠送源代码:spring-webmvc-5.3.7-sources.jar; 赠送Maven依赖信息文件:spring-webmvc-5.3.7.pom; 包含翻译后的API文档:spring-webmvc-5.3.7-javadoc-API文档...
赠送原API文档:springfox-spring-web-2.9.2-javadoc.jar; 赠送源代码:springfox-spring-web-2.9.2-sources.jar; 赠送Maven依赖信息文件:springfox-spring-web-2.9.2.pom; 包含翻译后的API文档:springfox-...
赠送原API文档:springfox-spring-webmvc-3.0.0-javadoc.jar; 赠送源代码:springfox-spring-webmvc-3.0.0-sources.jar; 赠送Maven依赖信息文件:springfox-spring-webmvc-3.0.0.pom; 包含翻译后的API文档:...
赠送原API文档:spring-webmvc-5.3.15-javadoc.jar; 赠送源代码:spring-webmvc-5.3.15-sources.jar; 赠送Maven依赖信息文件:spring-webmvc-5.3.15.pom; 包含翻译后的API文档:spring-webmvc-5.3.15-javadoc-API...
赠送原API文档:spring-webmvc-5.0.8.RELEASE-javadoc.jar; 赠送源代码:spring-webmvc-5.0.8.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-webmvc-5.0.8.RELEASE.pom; 包含翻译后的API文档:spring-web...
赠送原API文档:spring-security-web-5.6.1-javadoc.jar; 赠送源代码:spring-security-web-5.6.1-sources.jar; 赠送Maven依赖信息文件:spring-security-web-5.6.1.pom; 包含翻译后的API文档:spring-security-...
赠送原API文档:spring-web-5.3.15-javadoc.jar; 赠送源代码:spring-web-5.3.15-sources.jar; 赠送Maven依赖信息文件:spring-web-5.3.15.pom; 包含翻译后的API文档:spring-web-5.3.15-javadoc-API文档-中文...
赠送原API文档:spring-webmvc-5.3.7-javadoc.jar; 赠送源代码:spring-webmvc-5.3.7-sources.jar; 赠送Maven依赖信息文件:spring-webmvc-5.3.7.pom; 包含翻译后的API文档:spring-webmvc-5.3.7-javadoc-API文档...
赠送原API文档:spring-web-5.3.10-javadoc.jar; 赠送源代码:spring-web-5.3.10-sources.jar; 赠送Maven依赖信息文件:spring-web-5.3.10.pom; 包含翻译后的API文档:spring-web-5.3.10-javadoc-API文档-中文...
赠送原API文档:spring-webmvc-5.3.10-javadoc.jar; 赠送源代码:spring-webmvc-5.3.10-sources.jar; 赠送Maven依赖信息文件:spring-webmvc-5.3.10.pom; 包含翻译后的API文档:spring-webmvc-5.3.10-javadoc-API...
开发工具 spring-webmvc-4.3.6.RELEASE开发工具 spring-webmvc-4.3.6.RELEASE开发工具 spring-webmvc-4.3.6.RELEASE开发工具 spring-webmvc-4.3.6.RELEASE开发工具 spring-webmvc-4.3.6.RELEASE开发工具 spring-web...
赠送原API文档:spring-web-5.3.7-javadoc.jar; 赠送源代码:spring-web-5.3.7-sources.jar; 赠送Maven依赖信息文件:spring-web-5.3.7.pom; 包含翻译后的API文档:spring-web-5.3.7-javadoc-API文档-中文(简体)...
赠送原API文档:spring-webmvc-5.0.8.RELEASE-javadoc.jar; 赠送源代码:spring-webmvc-5.0.8.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-webmvc-5.0.8.RELEASE.pom; 包含翻译后的API文档:spring-web...
赠送原API文档:spring-web-5.3.7-javadoc.jar; 赠送源代码:spring-web-5.3.7-sources.jar; 赠送Maven依赖信息文件:spring-web-5.3.7.pom; 包含翻译后的API文档:spring-web-5.3.7-javadoc-API文档-中文(简体)-...
赠送原API文档:springfox-spring-web-3.0.0-javadoc.jar; 赠送源代码:springfox-spring-web-3.0.0-sources.jar; 赠送Maven依赖信息文件:springfox-spring-web-3.0.0.pom; 包含翻译后的API文档:springfox-...
赠送原API文档:spring-web-5.2.0.RELEASE-javadoc.jar; 赠送源代码:spring-web-5.2.0.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-web-5.2.0.RELEASE.pom; 包含翻译后的API文档:spring-web-5.2.0....