ant构建脚本don';t使用命令行在windows上运行

ant构建脚本don';t使用命令行在windows上运行,ant,build,Ant,Build,我已经编写了一个ant脚本,它运行正常并在eclipse中使用时生成.jar文件。 但当我在WindowsXP的命令提示符下使用它时,它显示成功,但什么也没发生。ant已正确配置,我还可以运行其他ant脚本 这是我的build.xml文件 <?xml version="1.0"?> <project name="TaskNodeBundle" basedir="."> <!-- Sets variables which can later be used.

我已经编写了一个ant脚本,它运行正常并在eclipse中使用时生成.jar文件。 但当我在WindowsXP的命令提示符下使用它时,它显示成功,但什么也没发生。ant已正确配置,我还可以运行其他ant脚本

这是我的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脚本时,它将执行
build.xml
文件中定义的第一个目标(在您的例子中是
clean

您可以在命令行上指定要执行的目标

$ ant target1 target2
或者在build.xml文件中使用
标记的默认属性定义默认目标:

<project name="TaskNodeBundle" basedir="." default="package-bundle">


如何执行它?在命令行上指定哪个目标?如果您只调用“ant”,它将是文件“clean”中的第一个目标,因为您没有通过键入ant和build.xml在目录中指定默认值。谢谢Matteo,它解决了问题