How to access --stacktrace or --full-stacktrace option in custom plugin

I would probably use a Logger so a user could increase verbosity with --info or --debug.

--stacktrace and --full-stacktrace really controls what kind of output Gradle prints at the end of the build. If you’re talking about collecting exceptions and then failing at the end, if you attach your exceptions as causes to the final exception you throw, it should just work.