In my testing throwing a GradleScriptException
only fails the build if an exception is thrown for every input artifact.
In the following example, Failing build
is printed, but the build does not fail, and the exception is not logged.
If the throw is unconditional, the build fails and all exceptions for all input artifacts are logged.
public abstract class Foo implements TransformAction<Foo.Parameters> {
...
@Override
public void transform(TransformOutputs outputs) {
File inputArtifactFile = getInputArtifact().get().getAsFile();
if (!inputArtifactFile.exists()) {
System.out.println("Failing build");
throw new GradleScriptException("", null);
}
}
}
How should I go about properly failing a build if something in my artifact transform fails?