如何让 javac 编译器将输出同时写入文件和控制台? [英] How to make javac compiler write the output to both file and console?

查看:22
本文介绍了如何让 javac 编译器将输出同时写入文件和控制台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ant 运行 javac 任务,并且为了报告目的,我使用 -Xstdout 编译器参数将输出发送到日志文件,但是我希望输出也仍然发送到控制台,以便 hudson 可以捕获它以供在屏幕上查看.

有没有办法做到这一点?

解决方案

刚刚遇到了另一个使用记录器任务的替代方案.更接近,因为您不必引入新目标.

<预><代码><编译><record name="log.txt" action="start"/><javac ...<record name="log.txt" action="stop"/><编译/>

I am running javac task using ant and I send the output to a log file using -Xstdout compiler argument for reporting purposes, but I would like the output also still being send to the console so hudson can capture it for on screen review.

Is there a way for this to be done?

解决方案

Just came across another alternative using the recorder task. Nearer as you don't have to introduce new targets.

<compile >
    <record name="log.txt" action="start"/>
    <javac ...
    <record name="log.txt" action="stop"/>
<compile/>

这篇关于如何让 javac 编译器将输出同时写入文件和控制台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆