1

I have a main ant script, that is used to initiate multiple project's ant script, in a certain sequence.

For each sub-project, I would like to to send out an email, notifying me whether the build was successful or not.

I understand that I can use the flag -logger with org.apache.tools.ant.listener.MailLogger to send out an email after the build finishes.

However, if I have multiple scripts that I want to send out an email, I'm not sure how to pass that flag -logger org.apache.tools.ant.listener.MailLogger into the ant call.

Precisely, I would like to pass the logger flag into this ant call:

< ant antfile="build.xml" dir="subproject/build" target="build" />

I tried using param and args, but didn't succeed.

DIF
  • 2,470
  • 6
  • 35
  • 49
phychem
  • 25
  • 5

1 Answers1

1

Good question. Personally I could not make it work with the ant target. It seems flags are not supported.

However, this hack works.

<exec executable="ant.bat">
    <arg value="-logger"/>
    <arg value="org.apache.tools.ant.listener.MailLogger"/>
    <arg value="-f"/>
    <arg value="other_build.xml"/>
</exec>

Two immediate issues with this approach:

  1. Not platform independent.
  2. Build reports success when sub-build fails (even with exec's failonerror='true')
Synesso
  • 37,610
  • 35
  • 136
  • 207
  • I finally did this: ant target1 target2 -logger org.apache.tools.ant.listener.MailLogger, and then put it into a .bat file... almost the same solution as yours... – phychem Dec 07 '12 at 04:05