简体   繁体   English

获取蚂蚁不将javac的stderr重定向到stdout

[英]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. 我试图将基于蚂蚁的Android构建添加到一个更大的基于grunt的构建系统中。 However, when ant is invoking javac , it's redirecting javac 's stderr to stdout (when adding the [javac] prefix to the console output). 但是,当ant调用javac ,它会将javac的stderr重定向到stdout(在控制台输出中添加[javac]前缀时)。 Unfortunately, this means that grunt is discarding the useful error output unless I run it in verbose mode - which I'd rather not do. 不幸的是,这意味着grunt会丢弃有用的错误输出,除非我以详细模式运行它-我宁愿不这样做。

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. 但是,将ant的stdout重定向到stderr会导致另一个问题,因为grunt构建会将任何 stderr解释为要中止的错误。

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. 我想要蚂蚁做的是将javac的stderr输出保留在stderr上(以便我了解为什么我的构建失败),并在stdout上保留stdout。 I don't see anything in Android's build.xml that would affect this, however, nor has ant's documentation been useful. 我没有在Android的build.xml中看到任何会影响此内容的内容,但是ant的文档也没有用。

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. 而且,当然,“简单地”将ant build.xml逻辑移植为仅作为grunt构建的一部分是一项相当大的任务,我目前不希望这样做。

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? 因此,stderr重定向背后是否存在我所缺少的ant (或Android的build.xml )选项,还是有其他方法可以使我的错误输出实际显示为错误?

you just need to use the "-e" option. 您只需要使用“ -e”选项。 you could set the ANT_ARGS environment variable like the following: 您可以像下面这样设置ANT_ARGS环境变量:

   export ANT_ARGS=-e
   ant ...

or 要么

   ant -e ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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