如何从 Ant 的 <java> 任务输出中删除前导 [java] 标签?

How to eliminate leading [java] label from Ant's <java> task output?

我正在使用 Ant 调用 <java> 任务来 运行 一个程序,该程序打印出一些东西到标准输出,最终,我希望用户能够轻松地复制粘贴.但是,stdout 的每一行都以 [java] 为前缀,这对用户造成了不必要的挑战。

有没有什么方法可以打印 只是 System.out.println(...) 的输出而不用 [java] 作为前缀?

设置ANT_ARGS=-emacs,见ant FAQ:

Ant adds a "banner" with the name of the current task in front of all logging messages - and there are no built-in regular expressions in your editor that would account for this.

You can disable this banner by invoking Ant with the -emacs switch. [...]

此外 ant manual Running Apache Ant 列出所有 cli 选项可能会有所帮助:

-emacs, -e produce logging information without adornments