ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Castrianni <Shawn.Castria...@halliburton.com>
Subject RE: Abort build with successful status
Date Mon, 15 Jun 2009 16:26:36 GMT
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:gudnabrsam@yahoo.com] 
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 <stevel@apache.org> wrote:

> From: Steve Loughran <stevel@apache.org>
> Subject: Re: Abort build with successful status
> To: "Ant Users List" <user@ant.apache.org>
> 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: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 


      

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

----------------------------------------------------------------------
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message