viebel
viebel

Reputation: 20670

In ant, how to apply a target on a list of files (without ant-contrib)?

Basically, I would like to mimic apply task but instead of passing to it anexecutable, I would like to pass an ant task and come up with something like:

<project>
   <target name="my-task">
      <!--target definition-->
   <target/>
   <target name="my-task-on-files">
        <apply task="my-task">
        <srcfile/>
        <targetfile/>
        <fileset dir="." includes="*.xml"/>
    </apply>
  </target>
</project>

The problem is that apply has to task attribute but only executable.

I need a solution that doesn't require ant-contrib.

Upvotes: 3

Views: 1200

Answers (1)

Mark O&#39;Connor
Mark O&#39;Connor

Reputation: 77971

No native solution in ANT. This is the sort of problem ant-contrib was invented to solve :-(

Basically, ANT was designed to be extended by writing custom tasks to solve non-standard build problems....

Personally, I think once your build needs complex logic, it's time to embed a full blown programming language. My tool of choice is groovy, due to it's tight integration with ANT. Furthermore, I use ivy to manage my build's 3rd party dependencies, so automatically adding groovy to the classpath is no hardship.

Upvotes: 3

Related Questions