Ant: how to always complete a task at the end of each run (regardless of purpose)

Is there a way to define a task in Ant that always runs at the end of each run? This SO question provides a way to do this at the start of each launch, before any other goals are met, but I'm looking at the opposite.

My use case is an echo message warning the user if a certain condition was detected during the run, but I want to make sure that he echoed at the very end to be noticed.

+4
source share
3 answers

This is an interesting situation. I would usually say that you cannot do this in an automatic way. You can wrap Ant in a shell script to do this, but Ant alone is not a complete programming language.

The only thing I can think of is to add a <ant> call at the end of each task to give out what you want. You can configure it so that if there is no variable, the echo will not happen. Of course, this means that you need to name the same goal a dozen or so in order to get this final <echo> .

I checked AntXtras and Ant -Contrib for possible methods, but could not find.

Unfortunately.

+1
source

use buildlistener i.e. exec-listener that provides a taskcontainer for each build result
(BUILD SUCCESSFUL | BUILD FAILED), where you can put all your necessary tasks, see:
fooobar.com/questions/1080945 / ...
for details.

+1
source

Wrap your calls in a serial container.

http://ant.apache.org/manual/Tasks/sequential.html

0
source

Source: https://habr.com/ru/post/1442629/


All Articles