-1

I will briefly explain the issue:

I am executing a gradle task through Hudson. The gradle task executes some groovy code. If I cancel the Hudson job, executing the gradle task, then the gradle task ends abruptly, without completely executing the groovy code inside it.

Is there a way, where even though the gradle task terminates abruptly, a block of code will defiantly execute? This is to handle graceful exit. Like in java we have a finally block.

Any help with this will be highly appreciated.

Andrey Adamovich
  • 20,285
  • 14
  • 94
  • 132
user1470220
  • 123
  • 2
  • 15

1 Answers1

0

It's not possible to do it in Gradle since Hudson is controlling the JVM process which executes Gradle/Groovy code. But since you are using Hudson, you can try to use some plugins to achieve what you need. For example, you can create another job and use Build Result Trigger Plugin, which will start that job when your original job failed.

Andrey Adamovich
  • 20,285
  • 14
  • 94
  • 132