Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6882145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:13:02+00:00 2026-05-27T05:13:02+00:00

My ant project generates an output folder which contains the outputs of multiple runs

  • 0

My ant project generates an “output” folder which contains the outputs of multiple runs and I would like to diff them all against files located in an “expected” folder (these lasts have the exact the same name as the ones in the output folder). I tried that:

<apply executable="diff">
    <fileset dir="${output.dir}" />
    <arg value="-u" />
    <srcfile />
    <arg value="${expected.dir}/" />
    <srcfile />
    <redirector>
         <outputmapper type="merge" to="result.out" />
    </redirector>
</apply>

But I have two problems:

First I am not allowed to put two <srclist /> in one <apply>, so how can I use two times the name of the current file treated in one <apply>?

Second I am not able to get the output of my <apply> in one single file. I tried different ways (putting the output argument in the <apply> tag…) but it always seems to only store the last execution of the apply. How can I append the result of each diff in one single file?

And I don’t want to have to install anything else (so no ant-contrib with foreach).

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:13:02+00:00Added an answer on May 27, 2026 at 5:13 am

    This works for me:

    <delete file="result.out" />
    <apply executable="diff" force="yes" output="result.out" append="true">
        <fileset dir="${output.dir}" />
        <srcfile />
        <targetfile />
        <mapper type="glob" from="*" to="${expected.dir}/*" />
    </apply>
    

    Some explanation:

    • The apply task targetfile element lets you specify a second arg that is derived from the srcfile via the mapper.
    • To get the merged output use the output attribute and set append true. Note that you may need to delete the output file (i.e. truncate it) otherwise on rerun you’ll not get a clean slate.
    • I fiddled with the arg list for diff to suit my OS, instead of passing expected.dir and the target file as successive elements, the mapper merges them into a single full path to the ‘right hand’ file for the diff.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Android project which I'm building in Ant and I'm stuck on
i have written an ant script, which runs ok and generate the .jar file
I would like to generate SQL DDL scripts from Hibernate/JPA Annotation Classes using ANT.
When I build my project to a Jar file with Ant, I generate javadoc
Trying to build my project with ANT in idea 10 and I get a
I'm trying to build my project using ANT. My project uses ActionbarSherlock, and Roboguice-Sherlock.
I am trying to build my android project using ant in command line mode.
I seem to have hit a snag while building my project using Ant. The
I use ant debug to build my project. After building with this command, my
I'm writing an Ant script to package a project into a WAR file. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.