You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by softwareforums2013 <so...@gmail.com> on 2013/10/26 04:46:31 UTC
how to tell ant to run the task at the end of build
hi everyone,
How can i tell ant to execute a task at the end of build
--
View this message in context: http://ant.1045680.n5.nabble.com/how-to-tell-ant-to-run-the-task-at-the-end-of-build-tp5714527.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
AW: how to tell ant to run the task at the end of build
Posted by Knuplesch,
Jürgen <Ju...@icongmbh.de>.
Hallo,
I wrote my own AntLogger to run a task in the end. This was necessary to rename log files that were otherwise locked by the Ant job:
In the logger I call in the buildfinished (this method is part of the usual logger) method a method that starts the final target:
public void buildFinished(BuildEvent event) {
final String msgFinish = super.buildFinished2(event);
final Project project = event.getProject();
final Hashtable properties = project.getProperties();
iconfinally(project, event);
....
In the iconfinally method I call Ant from java:
final private String FINAL_TARGET = "icon.finally"; // name of the target that will be started in the end of the build
private void iconfinally(Project project, BuildEvent event) {
Hashtable properties = project.getProperties();
// test if the Build failed
final Throwable error = event.getException();
if (error != null) {
project.setProperty(this.FINAL_TARGET + ".buildfailed", "true");
} else {
project.setProperty(this.FINAL_TARGET + ".buildfailed", "false");
}
project.executeTarget(this.FINAL_TARGET); // execute the final target in Buildfile
....
And now I only have to add this target into my buildfile
<target name="icon.finally" description="does final works e.g. saving the logfile">
<echo level="info" message="finally message" />
</target>
and add the Logger when I call Ant. (and add the Logger jar to my Ant installation)
call ant -f build.xml -logger de.icongmbh.ant.listener.YourLogger
....
I love this solution (-:
-----Ursprüngliche Nachricht-----
Von: softwareforums2013 [mailto:softwareforums2013@gmail.com]
Gesendet: Samstag, 26. Oktober 2013 04:47
An: user@ant.apache.org
Betreff: how to tell ant to run the task at the end of build
hi everyone,
How can i tell ant to execute a task at the end of build
--
View this message in context: http://ant.1045680.n5.nabble.com/how-to-tell-ant-to-run-the-task-at-the-end-of-build-tp5714527.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
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