目标清洁在项目目录中不存在

时间:2014-01-21 11:29:40

标签: ant build build-process

我在centos 6.3安装了Ant,安装位置是 /opt/antANT_HOME env相同

我已通过删除build.xml创建了testdir进行测试。这个目录存在于/opt/ant/testdir中,就像这样。

的build.xml

<?xml version="1.0"?>
<project name="testdir" default="all" basedir=".">
  <property name="src"   value="src"/>
    <property name="build" value="build"/>
      <property name="lib"   value="lib"/>

    <target name="all" depends="clean, compile" description="Builds the whole project">
        <echo>Doing all</echo>
    </target>

    <target name="clean">
        <echo message="Deleting bin/java ..." />
        <delete dir="testdir/test" />
    </target>
</project>

使用命令: -

    ant -buildfile build.xml Clean

收到错误: -

    BUILD FAILED
    Target "Clean" does not exist in the project "testdir".

是否有任何建议让它发挥作用?

2 个答案:

答案 0 :(得分:4)

您错误拼写了目标名称? “清洁”与“干净”相反?

答案 1 :(得分:4)

我找到了解决方案。我错过了target="compile"中的build.xml阻止。

<target name="compile">
    <echo message="Compiling source code"/>
</target>

运行命令: -

ant clean
相关问题