ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clifton C. Craig" <>
Subject Re: Updating Java source, JavaCC?
Date Fri, 30 Jan 2004 16:48:14 GMT
Thanks Eric,

My concern here is primarily with the precision of the text replacement. 
While I agree that JavaCC is overkill for what I'm doing I'm of the 
thinking that parsing a Java source file is a bit more complicated than 
regular expression technologies. It feels like one of those in between 
areas where I'd rather err on the side of caution due to the overall 
complexity. Also I'm no whiz with regular expressions. I feel they are 
cryptic, complicated, and dangerous if not used correctly. This is 
especially true when automating Java source editing. If there's an 
in-between solution that I'm overlooking please inform me. Thank you 
much for pointing me to the location of the JavaCC stuff. (I don't know 
why I could find this from the Ant docs.)


Erik Hatcher wrote:

> JavaCC sounds way overkill (and tangential even) to what you are 
> attempting.  The <javacc> task does have a dependency on the JavaCC 
> library itself (which is not included with Ant, you must obtain it 
> yourself.).  Personally, I got fed up with the <javacc> task and just 
> use <java> to launch it.
> Your job sounds most suited to a little command-line scripting magic 
> using Perl, sed, awk, Ruby, or something that is made for ripping 
> through text files.
>     Erik
> On Jan 29, 2004, at 12:02 PM, Clifton C. Craig wrote:
>> Hello all,
>> I have a requirement to update Java source files and insert a version
>> string in files that don't have one. We have a large source repository
>> so it would make most sense to automate this process. I've spent some
>> time investigating JavaCC to see if it could help me or if it would be
>> overkill for what I'm attempting. I noticed there is a javacc task in
>> Ant. It doesn't appear to have any external dependencies. I'm not even
>> sure which jar under ANT_HOME/lib it runs out of. Basically what I want
>> to do is create a Java source code parser that can update and insert
>> version string constants into Java classes (this includes inner classes
>> as well). If I didn't have the inner classes to bother with I would be
>> able to use our existing technologies which introspect binary .class
>> files to determine whether or not the version string is present and just
>> insert the string somewhere after the class declaration. Is what I'm
>> doing feasible or practical? Are there any better solutions available?
>> Cliff
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message