Grokbase Groups Ant user August 2009
FAQ

[Ant-user] Help needed regarding Java task

Gilbert Rebhan
Aug 27, 2009 at 7:39 pm
Nadun Herath schrieb:
...
I have to run a Java program Called MiniJavaParser using different file names as arguements several
times using Java Task. When it runs it gives the message

"MiniJava program parsed successfully" or Encountered errors during parse.

I want to declare a variable as a counter and increment it's value when it gives the message "MiniJava Program parsed successfully".

What is the approach I should take.
...

when your java task does things "several times" why not make it a new
ant task or a macrodef / scriptdef (use a language that runs on JVM via
BSF, f.e. jruby/groovy/beanshell/javascript/jython ...) ?

That way you'll have full access to ant api and project scope, means you
may set new properties (and even overwrite existing properties f.e. a
counter) for further processing in your ant workflow.

Other approaches =

grep the return from your java class with outputproperty, find examples
via google > ant+java+outputproperty, first result gives me =
http://www.nabble.com/%3Cjava%3E-outputproperty-problem--td19528043.html

the java task has several attributes to catch stdout stderr .. see =
http://ant.apache.org/manual/CoreTasks/java.html

low level = writing to a file as already mentioned in another post
from this thread



Regards, Gilbert





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

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 6 of 6 | next ›