How to make Ant build fail if standard out or error contains a warning? -
i have ant-based build worked on multiple developers. want discipline team causing hard build break if part of build pipeline emits warning.
realistically, think build needs fail if either stdout or stderr contains regex along lines of "\bwarn(ing)?\b|\berror\b|\bfatal\b"
\b
's word boundaries.
how can accomplish this?
if want control output of build, need implement custom listener. see https://ant.apache.org/manual/listeners.html more information. once implemented, can instruct ant use listener passing -listener fully_qualified_listener_classname
, assuming class added classpath.
basically need implement org.apache.tools.ant.buildlistener
, logic in messagelogged
method receives build event corresponding log generated task. event contains message logged can parse determine whether stop build, typically throwing runtime exception buildexception
.
Comments
Post a Comment