ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: Renaming the directories recursively
Date Wed, 27 Mar 2002 21:30:33 GMT

I am compiling the jsps and that is how these directories are created with
an "_" infront of all the directories. Infact, I don't want the "_". I
don't know a way to tell the compiler not create the "_" infront of the
directories or it would be even better, if the java and class files from
jsps can be created under the source directory itself. In that case, I
don't have to worry about this renaming at all.

The source directory structure is
The javas and classes are created under
../HIBERNIA/jsp_servlets/_com/_alltel/_ebusiness_/_pages/_*.java because of
the -d ${src} option I have to use.

I know, if I use the absolute path down to where the jsps are, I can
achieve what I want. But the problem there is, if somebody creates a new
directory with jsps, then I need to manually add that directory into my ANT
build file.

This is the ANT code I am using to compile jsps

<target name="jspcompile" depends="init">
     <apply executable="java">
     <arg line="-classpath ${cp} weblogic.jspc -compiler javac -d ${src} -keepgenerated
" />
     <fileset dir="${src}" includes="**/*.jsp/**" excludes="**/UIEngine/**,**/widgets/**"


From: Adam Murdoch <> on 03/26/2002 10:32 PM

Please respond to Ant Users List <>

To:   Ant Users List <>

Subject:  RE: Renaming the directories recursively

> -----Original Message-----
> From:
> []
> Sent: Wednesday, 27 March 2002 12:38 PM
> To: Ant Users List
> Subject: Renaming the directories recursively
> I want to rename the directories only recursively. Basically, I want to
> rename _com/_alltel/_ebusiness/........ to
> com/alltel/ebusiness............... I checked out the documentation, and
> figured out how to rename the files.
> This is the code I am trying to useand it renames only the top most
> directory leaving the subdirectories without renaming.
> <target name="move" >
>      <move todir="." >
>      <fileset dir="." includes="**" >
>      </fileset>
>      <mapper type="glob" from="_*" to="*"/>
>      </move>
>      </target>
>      Can somebody help me out ?

The names that get passed to the mapper are paths relative to the root
directory of the source file set.  So, in your case, the mapper will be
getting passed names like


This is why you're seeing only the top most directory being renamed - the
glob mapper is removing the first '_' only from all of the names.

Unfortunately, to solve your particular problem, I think you will have to
write your own mapper implementation.  It's not particularaly hard -
implement FileNameMapper to do the appropriate conversion, compile it up,
and use <mapper classname=".." /> to use it.

Of course, that is a rather odd directory layout you've got - why can't you
get rid of the underscores from the directory names and give the whole
renaming problem a miss?


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

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

View raw message