title: gradle avoid dependency task not to run if exception occurs
body: <p>I have two tasks.. task A and task B. I want task B to run every time task A is executed. In order to do this I use finalizedBy, but if task A throws a exception still task B execute is there a way to avoid this situation.</p>
  
  <p>task A {
    ...
  }</p>
  
  <p>task B {
    ...
  }</p>
  
  <p>A.finalizedBy B</p>
  
  <p>Output :</p>
  
  <p>Normally task A and B will be executed.</p>
  
  <p>If there is exception in A, B will also be executed. I don't want task B to be executed if task A throws exception.</p>