Hey there, is there a public way to declare that e...
# plugin-development
l
Hey there, is there a public way to declare that exception indicates a verification failure (akin to
org.gradle.internal.exceptions.NonGradleCause
)? I initially assumed it would be sufficient to use a
VerificationException
but that is still reported as if there was a technical build failure rather than a semantic failure. (Example in 🧵)
What I would like is failure to look like this:
Copy code
> Task :test FAILED
SomeTest > someTestMethod() FAILED
    java.lang.AssertionError at SomeTest.java:25
1 test completed, 1 failed
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///<...>/build/reports/tests/test/index.html
* Try:
> Run with --scan to get full insights.
BUILD FAILED in 3s
21 actionable tasks: 3 executed, 18 up-to-date
instead of
Copy code
> Task :customVerificationTask FAILED
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task 'customVerificationTask'.
> Custom verification failed

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights from a Build Scan (powered by Develocity).
> Get more help at <https://help.gradle.org>.

BUILD FAILED in 5s
8 actionable tasks: 2 executed, 6 from cache
Specifically, it would be nice if I could indicate that Gradle should omit the irrelevant bullet points under "Try:".
l
Thanks for the idea. I thought that the problems API should only be used to report problems with the build logic, but apparently using it for build failures is also a valid use-case. (Looking at https://docs.gradle.org/current/userguide/reporting_problems.html#build_failures)
v
Yeah, should be fine. Other than that, you could make your verification a JUnit Platform Engine and report them as failed or successful tests, then you get exactly what your asked for.