ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: Substring / regex on a package name?
Date Wed, 13 Oct 2004 10:54:17 GMT
Try the <replaceregexp> optional task.

Jan

> -----Urspr√ľngliche Nachricht-----
> Von: Ben Gill [mailto:Ben.Gill@t-mobile.co.uk]
> Gesendet am: Mittwoch, 13. Oktober 2004 12:35
> An: Ant Users List
> Betreff: RE: Substring / regex on a package name?
> 
> Thanks Ivan, that is great...
> 
> Re: the repackage - move certainly would be a start, but I was looking
> for a repackage task that would recurse from a point (ie. 
> '.') and move
> all dirs/java sources/props files etc.. into a new package 
> structure...
> 
> Ie. From com.oldapp to com.newapp ..
> 
> But also, I would want it to rename any paths in the files (ie.
> Com/oldapp to com/newapp) and any package names / import statements...
> 
> I had to write something like this last week, it is not quite generic
> enough to make it an offering as an optional task as yet... but I
> wondered if there was anything else out there like this....  I saw a
> rename packages task on java.dev.net somewhere but it did not seem to
> work..
> 
> Ben
> 
> 
> -----Original Message-----
> From: Ivan Ivanov [mailto:rambiusparkisanius@yahoo.com] 
> Sent: 13 October 2004 10:22
> To: Ant Users List
> Subject: Re: Substring / regex on a package name?
> 
> Hello, 
> > Hi,
> > 
> > I have two questions:
> > 
> > 1) I have a property called "com.myapp" within my
> > build.xml file (or at
> > least loaded in at runtime), and I want to strip off
> > everything past the
> > first dot (to get the base package name com)...
> > 
> > Is that possible?
> 
> You can use ant-contrib[1] task PropertyRegex, an
> example copied directly from[2] shows that it is
> possible:
>     <propertyregex property="pack.name"
>               input="package.ABC.name"
>               regexp="package\.([^\.]*)\.name"
>               select="\1"
>               casesensitive="false" />
>     
> This will yield ABC.
> 
> Or you can using a scripting language (like
> javascript) in ant to manipulate your string (but I am
> not so good in it to provide sample).
> 
> > 
> > 2) Is there a rename packages ANT task?
> > 
> There is a <move> task that can rename the packages
> viewed as directories. Is this want you want>
> 
> [1]http://ant-contrib.sourceforge.net
> [2]http://ant-contrib.sourceforge.net/tasks/propertyregex.html
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message