AlanSTACK
AlanSTACK

Reputation: 6065

How to generate a warning (not an exception)

How do I generate a warning in gradle build scripts to alert the user to something (potentially) problematic - but not mission critical.

I know you can throw exceptions like this

if (...) {
    throw new GradleException("something bad happened")
}

But what if I don't want to stop the build, but just let the user know something?

Upvotes: 1

Views: 554

Answers (1)

Arthur Attout
Arthur Attout

Reputation: 2916

I think this should work (from docs.gradle.org) :

Example: Writing your own log messages

logger.quiet('An info log message which is always logged.')
logger.error('An error log message.')
logger.warn('A warning log message.')
logger.lifecycle('A lifecycle info log message.')
logger.info('An info log message.')
logger.debug('A debug log message.')
logger.trace('A trace log message.')

Upvotes: 2

Related Questions