ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Ant output to console by running Java program
Date Mon, 10 Oct 2011 12:57:27 GMT
On 2011-10-10, adak wrote:

> Hi.I am new to Ant, so please tolerate. I am using eclipse and ant 1.8.2

I'm not an Eclipse user myself so I can't help with the details, sorry.

> I am trying to write a Java program (which uses Ant API) that checks if
> build.xml exists, then sets up project, target, and echoes a message.

> Q1)I am running the Java program, I can get the output from this in console
> but how do you get the output from Ant to print to eclipse console ? Is this
> even possible?

Any output Ant generates goes through Ant's own logging system.  You can
attach your own logger to the project instance and do with the logging
events whatever you think is best.[1] I don't know how to send anything
to the Eclipse console but you seem to know.  Also there likely already
exists some kind of Eclipse-Logger used by the Ant integration into
Eclipse (no idea where you'd find it and how it is called).

> Q2) Is it better for me to write an ant script that would call the java
> program and then this would call the required ant script?

Why would it?

Stefan

[1] http://ant.apache.org/manual/listeners.html and
Project#addBuildListener but you may need to do some additional steps to
re-wire System.out/err.  See Main#createLogger for what Ant's CLI entry
point does when dealing with the -logger argument.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message