开发者

System.out with Ant

开发者 https://www.devze.com 2023-01-22 04:38 出处:网络
I\'m googling without success to figure out how to make ANT print System.out.println/System.out.prin开发者_StackOverflow中文版t messages in the console. Messages simply don\'t appear. I haven\'t found

I'm googling without success to figure out how to make ANT print System.out.println/System.out.prin开发者_StackOverflow中文版t messages in the console. Messages simply don't appear. I haven't found any simple way of doing this. Is there any?

Thanks


The junit task printsummary attribute has a special setting withOutAndErr that:

is the same as on but also includes the output of the test as written to System.out and System.err.


Use the echo task

<echo message="Hello, world"/>
<echo message="Hello, file" file="logfile.txt" />

If you want to read the output from a <java> task, use the outputproperty attribute:

<java ... outputproperty="javaoutput" />
<echo message="${javaoutput}" />


Another cause for not seeing standard output from your program is if you have forked the java process.

This will happen if you are using the Java task and have chosen to fork the execution to another VM:

<java classname="com.example.MyClass" fork="true">
    ...
</java>
0

精彩评论

暂无评论...
验证码 换一张
取 消