build.xml
<?xml version="1.0"?>
<project name="springapp" basedir="." default="usage">
<property file="build.properties"/>
<property name="src.dir" value="src"/>
<property name="web.dir" value="war"/>
<property name="webapp" value="G:/apache-tomcat-7.0.23/webapps/springapp"/>
<property name="build.dir" value="${webapp}/WEB-INF/classes"/>
<property name="name" value="springapp"/>
<path id="master-classpath">
<fileset dir="${web.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<!-- We need the servlet API classes: -->
<!-- * for Tomcat 5/6 use servlet-api.jar -->
<!-- * for other app servers - check the docs -->
<fileset dir="${appserver.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="stop --> Stop Tomcat application"/>
<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}" source="1.5" target="1.5" debug="true"
deprecation="false" optimize="false" failonerror="true"
includeantruntime="false">
<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>
<!-- ============================================================== -->
<!-- Tomcat tasks - remove these if you don't have Tomcat installed -->
<!-- ============================================================== -->
<path id="catalina-ant-classpath">
<!-- We need the Catalina jars for Tomcat -->
<!-- * for other app servers - check the docs -->
<fileset dir="${appserver.lib}">
<include name="catalina-ant.jar"/>
</fileset>
</path>
<taskdef name="install" classname="org.apache.catalina.ant.DeployTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="list" classname="org.apache.catalina.ant.ListTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="start" classname="org.apache.catalina.ant.StartTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask">
<classpath refid="catalina-ant-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}"/>
</target>
<target name="stop" description="Stop Tomcat application">
<stop url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${name}"/>
</target>
<target name="list" description="List Tomcat applications">
<list url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"/>
</target>
<!-- End Tomcat tasks -->
</project>
build.properties
# Ant properties for building the springapp
appserver.home=G:/apache-tomcat-7.0.23
# for Tomcat 5 use $appserver.home}/server/lib
# for Tomcat 6 use $appserver.home}/lib
appserver.lib=${appserver.home}/lib
deploy.path=${appserver.home}/webapps
tomcat.manager.url=http://localhost:8080/manage
r/text
tomcat.manager.username=admin
tomcat.manager.password=admin
XML parsing error on file jndi:/localhost/springapp/WEB-INF/web.xml: (line 6, col 17)] with root cause
org.xml.sax.SAXParseException; systemId: jndi:/localhost/springapp/WEB-INF/web.xml; lineNumber: 6; columnNumber: 17; 与元素类型 "web-app" 相关联的属性名 "xsi:xsi" 必须后跟 ' = ' 字符。
把spring.jar 和 common-logging.jar 放到 WEB-INF/lib下 就Ok咯
分享到:
相关推荐
蚁群算法解决TSP问题
这个名是名离自ant原码的,由于java.util.zip处理中文文件名时有问题可以用这个包代替那个使用就不会有中文问题了,我加了一个ZipTool.java,这个就是一个示例文件和方法打包文件。 <br>特点: 一、自有原码不...
解决Eclipse+Ant启动任务失败的问题,在Eclipse中Windows->Preferences->Ant->Runtime->Classpath->Global Entries中加入即可
Ant的中文文件名乱码问题的解决--ant1.8.4 tar中文文件名乱码问题
Android SDK 26以后ant编译错误解决办法(错误信息:taskdef A class needed by class com.android.ant.GetUiTargetTask) https://blog.csdn.net/xlyrh/article/details/107766878
一些工具如Jam一定程序上解决了这个问题,但仍有其它的格式问题。 Ant与从基于命令的那些扩展开来的那些工具不同,Ant是由java类扩展的。不用编写shell命令,而是配置基于XML的文件,形成多个任务的目标配置树。每...
ant配置后提示不是内部命令也不是外部命令解决办法: 1、解压缩包。例如解压到E:\学习类\apache-ant-1.8.2, 2、配置环境变量。在系统环境变量中新建一个ANT_HOME 的变量,值为D:\apache-ant-1.10.1。在path 变量中...
ant 解决 打jar包后class 的 Aspect问题
AntDesign3.9.x 企业级产品的设计体系,基于确定和自然的设计价值观上的模块化解决方案,让设计者和开发者专注于更好的用户体验。 如何在 Axure 里使用 Ant Design Library: 1. 打开 Axure 软件,找到 Libraries ...
利用ant.jar解压缩zip包的工具类,内含ant.jar包,可以解决文件为中文的问题,大家随便看看
页面懒加载:使用@loadable/component来解决首次打开页面过慢的问题. Ajax 请求:restful 规范,自动错误提示,提示可配置;自动打断未完成的请求; 权限控制: 根据不用角色的功能类型显示菜单,路由页面拦截. 自定义...
apache-ant-zip.jar 解决中文乱码解压问题
原因:这个主要是因为我们在写代码的时候加入了一些中文注释,而导致编译时候出现的问题。 解决方式:要处理这个问题,仅仅只需要在 build.xml文件中的调用javac的所有地方加入encoding的参数。
Android ant 多渠道批量打包解决方案
蚁群算法解决城市遍历最短路径问题TSP问题-ant.rar 这个是完整的城市最短路径遍历问题,函数是从网上下载的,不过我自己做了testant.m程序,完全可以调试通过,对初学者有一定得帮助。 只需要运行testant.m程序...
贯穿全书,作者通过一个应用程序的逐步完善和复杂,来展现应用如何进展,以及如何解决构造和测试的问题。该书涵盖了大量项目实例,先进的性能特征以及在别的地方难以获得的详细深入的讨论。这本书适合所有Java开发者...
贯穿全书,作者通过一个应用程序的逐步完善和复杂,来展现应用如何进展,以及如何解决构造和测试的问题。该书涵盖了大量项目实例,先进的性能特征以及在别的地方难以获得的详细深入的讨论。这本书适合所有Java开发者...
所以,书中提到的一些问题,比如自定义 DataType 的缺陷,可能已经完善地得到了解决。 本书不但从 Ant 技术上进行了详细、本质的讲解,同时结合作者经历过的各种项目经验,对项目结构控制也进行了总结性、归纳性的...
ANT构建解决方案-应用指南.
这是一个ant的虚拟表格,用于解决大数据渲染时页面卡顿的问题,本组件是对ant.desigin中Table组件进行一层封装,属性完全与原组件表保持一致的,可以让你实例中处理渲染1000万条数据,页面也非常流畅。 设计说明 ...