I think as mentioned, that this approach would solve the ANT return code, but
would still print out BUILD FAILED. Poking around the source code of ANT, (I
love open source). I found a perfect solution by writing my own task. See
below. It uses the fireBuildFinished method from the Project. It works great
and even prints out the Total time: message at the end of the build like normal.
package com.lgc.btlite;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
public class EndTask extends Task {
protected String _message = null;
public void execute()
{
if((_message != null) && (_message.length() > 0))
log("\n" + _message,Project.MSG_INFO);
getProject().fireBuildFinished(null);
System.exit(0);
}
public void setMessage(String message)
{
_message = message;
}
}
---
Shawn Castrianni
-----Original Message-----
From: Matt Benson [mailto:[email protected]]
Sent: Monday, June 15, 2009 8:14 AM
To: Ant Users List
Subject: Re: Abort build with successful status
Ah, I had already replied similarly before seeing your response, Steve. :)
--- On Mon, 6/15/09, Steve Loughran <[email protected]> wrote:
> From: Steve Loughran <[email protected]>
> Subject: Re: Abort build with successful status
> To: "Ant Users List" <[email protected]>
> Date: Monday, June 15, 2009, 6:43 AM
> You could fail but set the exit code
> to 0. It will still print fail, though that is actually the
> job of the logger. There's no reason why a custom logger
> cant skip that fail message if the exit code is 0, or even
> print out whatever the exception message text is that
> <fail> raises.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and
privileged information for the sole use of the intended recipient. Any review,
use, distribution, or disclosure by others is strictly prohibited. If you are
not the intended recipient (or authorized to receive information for the
intended recipient), please contact the sender by reply e-mail and delete all
copies of this message.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]