System.out with Ant
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>
精彩评论