Hello,
For your requirement of buid end date/time, you can add a task which is a
build listener and when you receive the "build started" event you get
date/time from system and also when you receive "build finished". You just
have to print the date/time difference...?

Beware with listeners, I try to understand my "build finished event not
received" problem and after many tests, it seems that if I execute the
"listener task" in a task called by <antcall>, it never receives the event
"build finished"... Strange.
Christian.

----- Original Message -----
From: "Benoit Voisin" <[EMAIL PROTECTED]>
To: "'Ant Users List'" <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 6:32 PM
Subject: RE: "finally" task, listener problem


> I cannot answer your problem, but if someone goes in the ant code to
correct
> anything, I would find very usefull that the "Build Successfull in XX
> seconds" also contained a date/time. If I have time and other find it
> usefull I will probably try to submit a patch on that.
>
> Benoit
>
> -----Original Message-----
> From: Christian Nerrière [mailto:[EMAIL PROTECTED]]
> Sent: 19. december 2002 17:58
> To: [EMAIL PROTECTED]
> Subject: "finally" task, listener problem
>
>
> Hello,
>
> I have got a problem with build listener : I have created a <finally> task
> to perform some tasks when build is finished. This tasks implements
> "TaskContainer" interface so it contains some sub-tasks to execute on
build
> end and it implements "BuildListener" interface too to receive the
"finished
> build" event. The code of this is relatively simple.
> When I use this task in the begin of build, it works good but when I use
it
> in the middle of the script (900 code lines), the "finished build" event
> seems to be never received by the task...
> Does someone has an idea about this ?
> Thanks.
> Christian.
>
> Following, the code of this very complex task :
>
> public class Finally
>   extends Task
>   implements BuildListener, TaskContainer {
>
>   private Vector _subTasks = new Vector();
>   private String _buildSuccessProperty = null;
>
>  /**
>   * Set attribute "buildSuccessProperty"
>   * @param onSuccessful
>   */
>   public void setBuildSuccessProperty( String buildSuccessProperty ) {
>     _buildSuccessProperty = buildSuccessProperty;
>   }
>
>  /**
>   * Signals that a build has finished.
>   * @param event
>   */
>   public void buildFinished(BuildEvent event) {
>
> trace("buildFinished");
>
>     Throwable e = event.getException();
>     if ( e == null ) {
>       trace( "build successful." );
>       if ( _buildSuccessProperty != null ) {
>         // Build has succeeded: set the success property
>         super.project.setProperty(_buildSuccessProperty, "true");
>         trace( "property ["+_buildSuccessProperty+"] set!" );
>       }
>     }
>     else {
>       e.printStackTrace();
>       trace( "build failed." );
>     }
>
>     for (int i=0 ; i< _subTasks.size() ; i++ ) {
>       Task task = (Task) _subTasks.get(i);
>       task.execute();
>     }
>   }
>
>  /**
>   * Signals that a build has started.
>   * @param event
>   */
>   public void buildStarted(BuildEvent event) {
>   }
>
>  /**
>   * Signals a message logging event.
>   * @param event
>   */
>   public void messageLogged(BuildEvent event) {
>   }
>
>  /**
>   * Signals that a target has finished.
>   * @param event
>   */
>   public void targetFinished(BuildEvent event) {
>     trace( "targetFinished" + event.getTarget());
>   }
>
>  /**
>   * Signals that a target is starting.
>   * @param event
>   */
>   public void targetStarted(BuildEvent event) {
>     trace( "targetStarted" + event.getTarget());
>   }
>
>  /**
>   * Signals that a task has finished.
>   * @param event
>   */
>   public void taskFinished(BuildEvent event) {
>     trace( "taskFinished" + event.getTask());
>   }
>
>  /**
>   * Signals that a task is starting.
>   * @param event
>   */
>   public void taskStarted(BuildEvent event) {
>     trace( "taskStarted" + event.getTask());
>   }
>
>  /**
>   * Task execution.
>   * @throws BuildException
>   */
>   public void execute() throws BuildException {
>
>     getProject().addBuildListener( this );
>     trace( "execute: build listener added" );
>   }
>
>  /**
>   * Adds a task to this task container
>   * @param task
>   * @see org.apache.tools.ant.TaskContainer
>   */
>   public void addTask(Task task) {
>
>    _subTasks.add(task);
>   }
>
>  /**
>   * Trace method.
>   * @param message
>   */
>   public void trace( String message ) {
>     getProject().log( this, message, Project.MSG_VERBOSE );
>   }
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to