100分问一个关于ant时build.xml的问题

大河V5 2005-08-05 11:09:48
我的build.xml文件为
<project name="test" default="buildwar" basedir=".">
<!--Load The Build Properties File-->
<property file="build.properties"/>

<property name="app.name" value="app"/>
<property name="lib.root.path" value="lib"/>
<property name="src.root.path" value="src"/>
<property name="webcontext.root.path" value="web"/>
<property name="configs.root.path" value="configs"/>

<!--Define The Classpath-->
<path id="classpath">
<fileset dir="${lib.root.path}">
<include name="**/*.jar"/>
</fileset>
</path>

<target name="clean">
<delete dir="${build.root.path}"/>
</target>

<target name="prepare" depends="clean">
<mkdir dir="${build.root.path}"/>
</target>

<target name="compile" depends="prepare">
<!--1. Compile Java Source Files-->
<javac srcdir="${src.root.path}" destdir="${webcontext.root.path}/WEB-INF/classes" debug="true">
<classpath refid="classpath"/>
</javac>

<!--2. Convert Properties Files-->
<native2ascii
encoding="GB2312"
src="${src.root.path}"
dest="${webcontext.root.path}/WEB-INF/classes"
includes="**/*_zh_ascii.properties **/*_ja_ascii.properties"/>

<!--3. Copy Other Required Files-->
<copy todir="${webcontext.root.path}/WEB-INF/classes">
<fileset dir="${src.root.path}"
includes="**/*.properties **/*.png **/*.gif **/*.jpg **/*.psd **/*.xml **/*.html **/*.htm **/*.dtd **/*.css **/*.jsp **/*.js **/*.tld"/>
</copy>

</target>

<target name="buildwar" depends="compile">
<copy todir="${build.root.path}">
<fileset dir="${webcontext.root.path}"/>
</copy>
<jar jarfile="${build.root.path}/${app.name}.war" basedir="${build.root.path}"/>
</target>

<target name="deploy" depends="buildwar">
<copy todir="${src.root.path}" file="${build.root.path}/${app.name}.war"/>
</target>

</project>

build.properties文件如下:

build.root.path = build
deploy.path = C:/Tomcat4.1/webapps



为什么我ant的时候,最后一句不执行?就是下面deploy这句。

<target name="deploy" depends="buildwar">
<copy todir="${src.root.path}" file="${build.root.path}/${app.name}.war"/>
</target>


...全文
153 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
大河V5 2005-08-05
  • 打赏
  • 举报
回复
多谢
OK了
congliu 2005-08-05
  • 打赏
  • 举报
回复
ant build/ant clean/ant deploy等
ant后要指定编译的类型
congliu 2005-08-05
  • 打赏
  • 举报
回复
ant build/ant clean/ant deploy等
ant后要指定编译的类型
晨星 2005-08-05
  • 打赏
  • 举报
回复
要么运行ant时,别只在命令行上打一个“ant”,而是输入“ant deploy”。
晨星 2005-08-05
  • 打赏
  • 举报
回复
把第一行:
<project name="test" default="buildwar" basedir=".">
改成:
<project name="test" default="deploy" basedir=".">

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧