简体   繁体   中英

Getting ant to not redirect javac's stderr to stdout

I am trying to add an ant-based Android build into a greater grunt-based build system. However, when ant is invoking javac , it's redirecting javac 's stderr to stdout (when adding the [javac] prefix to the console output). Unfortunately, this means that grunt is discarding the useful error output unless I run it in verbose mode - which I'd rather not do.

However, redirecting ant 's stdout to stderr causes a different problem, in that the grunt build interprets any stderr as an error to abort on.

What I would like for ant to do is to keep javac 's stderr output on stderr (so that I see why my build failed), and stdout on stdout. I don't see anything in Android's build.xml that would affect this, however, nor has ant's documentation been useful.

And, of course, "simply" porting the ant build.xml logic to just be part of the grunt build is a rather large undertaking that I'd rather not do at this time.

So, is there some option to ant (or Android's build.xml ) that I'm missing that is behind the stderr redirection, or is there some other approach to actually getting my error output to display as an error?

you just need to use the "-e" option. you could set the ANT_ARGS environment variable like the following:

   export ANT_ARGS=-e
   ant ...

or

   ant -e ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM