2

build.xml ファイルと同じディレクトリにある nonsense.class を含め、build.xml ファイルと同じディレクトリからすべての .class および .jar ファイルを削除する Ant タスクを設定したいと思います。そこで、ant 1.9.0 用の次の build.xml ファイルを次のように設定しました。

<?xml version="1.0"?>
<project name="HelloWorld" default="deploy">
  <!-- ... -->
  <target name="clean">
    <delete file="nonsense.class" />
    <delete file="*.class" />
    <delete file="*.jar" />
  </target>
</project>

実行すると nonsense.class は削除されますが、他の .class または .jar ファイルは削除されません。私は何を間違っていますか?

4

1 に答える 1

13

複数のファイルを削除するには、ファイルセットを使用する必要があります。

  <target name="clean">
    <delete file="nonsense.class" />
    <delete>
      <fileset dir=".">
        <include name="*.class"/>
        <include name="*.jar"/>
      </fileset>
    </delete>
  </target>
于 2013-05-25T20:12:31.417 に答える