1
我已经写了一个ant脚本,它运行正常,并在eclipse中使用它时生成.jar文件。 但是,当我在Windows XP上的命令提示符上使用它时,它显示成功,但没有任何反应。蚂蚁已正确配置,我也可以运行其他蚂蚁脚本。ant build脚本不能在windows上使用命令行运行
这里是我的build.xml文件
<?xml version="1.0"?>
<project name="TaskNodeBundle" basedir=".">
<!-- Sets variables which can later be used. -->
<!-- The value of a property is accessed via ${} -->
<property name="bundlename" value="task-node-bundle" />
<property name="src.dir" location="../src" />
<property name="lib.dir" location="../lib" />
<property name="build.dir" location="/buildoutput" />
<property name="build.dest" location="build/dest" />
<!--
Create a classpath container which can be later used in the ant task
-->
<path id="classpath">
<fileset dir="${lib.dir}/">
<include name="*.jar" />
</fileset>
</path>
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${build.dest}" />
</target>
<!-- Deletes the existing build directory-->
<target name="mkdir" depends="clean">
<mkdir dir="${build.dest}"/>
</target>
<!-- Compiles the java code -->
<target name="compile" depends="mkdir">
<javac srcdir="${src.dir}" destdir="${build.dest}" classpathref="classpath" />
</target>
<target name="package-bundle" depends="compile" description="Generates the bundle">
<jar destfile="${dist.dir}/${bundlename}.jar">
<fileset dir="${src.dir}">
<include name="**/**.class" />
<include name="**/**.properties"/>
<include name="/META-INF/**.*" />
<include name="/META-INF/spring/**.*" />
</fileset>
</jar>
</target>
</project>
你如何执行它?你在命令行中指定了哪个目标?如果你只是调用“ant”,它将成为文件“clean”中的第一个目标,因为你没有指定默认 – Matteo
,通过键入ant和build.xml在 – vicky
目录中有,谢谢Matteo,它解决了问题 – vicky