Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Problems with <mapper type="regexp"
Problems with <mapper type="regexp" [message #120734] Tue, 02 September 2003 20:45
Eclipse UserFriend
Originally posted by: johncook.us.ibm.com

I am having a good bit of trouble getting the <present> selector to work with a
regexp mapper on Ant 1.5.2. I have a test case of a simple SRC directory
holding a few Java source files and a simple DEST directory holding the compiled
Java class files. There is also one .properties file that has the same name and
path in both the SRC and DEST directories

The following target will identify only the .properties file, probably because
of the identity mapping:

<target name="StdCleanJavaClasses" >

<fileset id="f1" dir="${_dest}" casesensitive="false" >
<present present="both" targetdir="${_src}" >
<mapper type="regexp"
from="^(.*)\.properties$$"
to="\1.properties" />
</present>
</fileset>

<pathconvert pathsep=";" dirsep="/" property="_list1" refid="f1" >
</pathconvert>

<echo> src=${_src}
dest=${_dest}
list1=${_list1}</echo>
</target>

The target above produces an output like the following:

StdCleanJavaClasses:
src=c:/u/johncook/src/wsad500/IsmpAntTaskProject/src.java
dest=c:/u/johncook/src/wsad500/IsmpAntTaskProject/build/bin/ java
list1=C:/u/johncook/src/wsad500/IsmpAntTaskProject/build/bin /java/com/ibm/eou/ant/ismp/Ismp5Task.properties


The problem comes with the .java to .class mapping. If I redo the sample target
above with a more complicated mapper, I never get a match. I would expect to
see a list of all the .class files that have a matching source file.

<target name="StdCleanJavaClasses" >
<echo>StdCleanJavaClasses:</echo>
<fileset id="f1" dir="${_dest}" casesensitive="false" >
<present present="both" targetdir="${_src}" >
<mapper type="regexp"
from="^${_src}/(.*)\.java$$"
to="${_dest}/\1.class" />
</present>
</fileset>

<pathconvert pathsep=";" dirsep="/" property="_list1" refid="f1" >
</pathconvert>

<echo> src=${_src}
dest=${_dest}
list1=${_list1}</echo>

</target>

The output from this target is an empty list.

StdCleanJavaClasses:
src=c:/u/johncook/src/wsad500/IsmpAntTaskProject/src.java
dest=c:/u/johncook/src/wsad500/IsmpAntTaskProject/build/bin/ java
list1=

Some questions:
(1) is there some regexp quoting that has to happen when matching ${_src} ?
(2) if so, how do I quote regexp in Ant
(3) is the regexp pattern of the second target correct? maybe I have
confused source and destination somewhere.

Any help would be greatly appreciated.
Thanks
John Cook
Previous Topic:Eclipse CVS - suggestions for update
Next Topic:How to detect if a plugin is present
Goto Forum:
  


Current Time: Tue Jul 15 11:53:09 EDT 2025

Powered by FUDForum. Page generated in 0.06292 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top