ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey N. Solofnenko" <>
Subject Re: Commenting System.out.println using ant
Date Wed, 04 Aug 2004 18:01:09 GMT
Depending on a situation it can be easy or difficult. If you know that 
System.out.println()... is always the last statement on a line, you can 

<replace token="System.out.println" value="; //System.out.println"/>


<replace token="System.out.println" value="{} //System.out.println"/>

or (if you expect spaces):

<replaceregex match="System\s*\.s*out\s*\.\s*println" replace="{} 

It might be also useful to change the commented string a little, so the 
next ANT execution will not add a comment into the same lines again.

If the assumption is not true, you would have to use a complex regular 
expression or a Java language parser in order to extract all still 
uncommented print calls.

- Alexey.

Nitin Kumar wrote:

>Is there a way using ant which will comment out all System.out.printlns
>in my java class?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message