ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <>
Subject Re: Removing Comments During Build
Date Sat, 11 Jun 2005 19:45:49 GMT
That's a good point, you won't be able to use JSP comments in static 
files obviously... I've gotten spoiled in my work in that everything is 
on the app server in an EAR lately, so I haven't had such concerns in 
the past year or so.

I don't have any other suggestions unfortunately for those cases... 
stripping them out probably becomes your best option at that point.

I've never heard of anyone doing such a thing, but it doesn't seem too 
bizarre either, I'm sure someone has.  I know I've used that 
replaceregexp task I mentioned to switch my app to work on Tomcat and 
Websphere because I develop on Tomcat but deploy to Websphere in 
production and there are some differences... that task lets me "flip 
some bits" in config files based on the presence of a given property.

I would think the same thing would work for you... If I'm remembering my 
regex properly (and there is every chance I am not!), doing...

&lt;!--*.--&gt; the expression to match, and then replace it with "", should do 
the trick... Of course, that assumes all your comments are on a single 
line, so you may have to have more than one regex to catch multi-line as 
well (I'm not sure off the top of my head to indicate the possibility of 
spanning lines in regex).  You could do another for // and /* */ 
comments... the former should be pretty easy, the later again deals with 
line spans.

Let me know if that works for you... if you have any trouble let me know 
and I'll play a bit... practice writing regex expressions is never a bad 
thing :)


Tom Frantz wrote:
> Thanks for your suggestion about using JSP comments for everything to 
> hide them from the browser.  That will definitely help me with my app 
> server stuff.
> What about the files being served by the web server?  We have some 
> static html pages and JavaScript libraries there with comments we would 
> also like to prevent from being sent to the browser.
> Have you ever heard of anyone using an Ant task for stripping out comments?
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies

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

View raw message