Target Clean does not exist in the project dir

30,326

Solution 1

I have found solution. I missed target="compile" block in build.xml.

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

Run command :-

ant clean

Solution 2

You mis-spelt the target name ? 'Clean' as against 'clean' ??

Share:
30,326
Roopendra
Author by

Roopendra

This is Roopendra Vishwakarma, A DevOps Engineer and Blogger from India. Having experience in DevOps and Web-Development Technology. Tags Given By Me:- ansible-playbook and elasticsearch-jdbc-river Blog :- http://techieroop.com

Updated on January 28, 2020

Comments

  • Roopendra
    Roopendra over 4 years

    I have installed Ant in my centos 6.3 , installed location are /opt/ant and also ANT_HOME env are same

    I have created build.xml to test by deleting testdir. This directory exist in the /opt/ant/testdir like this.

    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>
    

    Using Command :-

        ant -buildfile build.xml Clean
    

    getting error:-

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

    Any suggestion to make it work?

  • Roopendra
    Roopendra over 10 years
    I have tried you solution. getting error Target "compile" does not exist in the project "testdir". It is used from target "all".