简体   繁体   中英

ANT doesn't run anything inside <target>

When i put any thing inside a target tag its doesn't run whats inside it. eg.

<project name="Test" >
    <target name="clean">
        <delete dir="bin" />
        <mkdir dir="bin" />
        <echo>Hello 1</echo>
    </target>

    <target name="compile" depends="clean">
        <javac srcdir="src" destdir="bin" />
        <echo>Hello 2</echo>
    </target>

    <echo>Hello 3</echo>
</project>

All i get is:

[echo] Hello 3

You could either set a default task like

<project name="Test" default="compile"> 

or invoke a task from command lie (or IDE)

ant compile

Well no wonder since your project has no default = "" attribute specified.

You will either have to write the project element like this :

<project name="Test" default="compile">

Or you will have to call the ant.bat or whatever it is you are calling with the specified target to run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM