Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
Removing Comments During Build

Removing Comments During Build

2005-06-13       - By Burgess, Benjamin
Reply:     1     2     3     4     5     6  

Perhaps the StripJavaComments FilterChain would be of use?
http://ant.apache.org/manual/CoreTypes/filterchain.html#stripjavacomment
s

Ben Burgess
TIAA-CREF

-----Original Message-----
From: Frank W. Zammetti [mailto:fzlists@(protected)]
Sent: Saturday, June 11, 2005 3:46 PM
To: Ant Users List
Subject: Re: Removing Comments During Build

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...

<!--*.-->

...as 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 :)

Frank

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: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>
>

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)



**************************************************************
This message, including any attachments, contains confidential information
intended for a specific individual and purpose, and is protected by law.  If
you are not the intended recipient, please contact sender immediately by reply
e-mail and destroy all copies.  You are hereby notified that any disclosure,
copying, or distribution of this message, or the taking of any action based on
it, is strictly prohibited.
TIAA-CREF
**************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.