Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.out with Ant

Tags:

java

ant

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

Thanks

like image 743
Denis Kniazhev Avatar asked Oct 28 '10 12:10

Denis Kniazhev


People also ask

What is Java with Ant in Netbeans?

Apache Ant is a Java library and command-line tool for automating software build processes. Imagine you are working on a Java project that contains many classes and the build process involves in compiling . java files to . class files, then packaging the compiled files to an executable JAR file.

What is Ant in software?

Ant is a Java-based build tool created as part of the Apache open-source project. You can think of it as a Java version of make. Ant scripts have a structure and are written in XML. Similar to make, Ant targets can depend on other targets. For example, Ant is used in the context of plug-in development in the build.

What is Ant in testing?

The ANT is a task designed to test three attentional networks in children and adults: alerting, orienting, and executive control.

Is Apache Ant still used?

Apache Ant is well-established Developers have been using Apache Ant in Java development cycles longer than any other build tool. Apache Ant, which debuted in 2000, is the oldest, still widely used Java build tool. As a result, it has a well-established user base.


2 Answers

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.

like image 92
martin clayton Avatar answered Sep 22 '22 22:09

martin clayton


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}" />
like image 37
Sean Patrick Floyd Avatar answered Sep 22 '22 22:09

Sean Patrick Floyd