ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William Ferguson" <>
Subject replaceregexp Task and RegExp Mappers
Date Fri, 07 Feb 2003 04:52:24 GMT
Hi all,

We're using Ant 1.5 and are trying to use both the replaceregexp task and
the regexp Mapper (during a Copy), but it seems that classloading has become
a bit of an issue.

When we attempt to execute the replaceregexp task, it fails with the
RegexpFactory reporting, with "No supported regular expression matcher
found", even though all our optional tasks are defined with explicit
classpaths, including the Oro classes. Presuambly it can't find the Oro
classes, which makes sense because the RegexpFactory would be in the
bootclassloader as it is contained within Ant jar.

When we attempt to execute a Copy with a regexp mapper specified, where the
classpath defined for the mapper includes optional jar and oro jar, we again
get a "No supported regular expression matcher found" though this time from
the RegexpMatcherFactory. And again this makes sense as the
RegexpMatcherFactory is conatined within ant jar which will have been loaded
into the bootclassloader.

I'm looking for a solution that lets me performs both tasks but doesn't
compromise our current build environment.

I've trolled the on-line doco and re-read
I've also trolled the ant-user archives and see that John Towell had
essentially the same question on the 26th Jan. The only soltion suggested to
him was to add all the 3rd part libraries into the bootclasspath when Ant is
started, with the suggested mechanism being the addition of the extra jars
into the ANT_HOME/lib directory.

This is not a good option for us, as our development environment uses
standard scripts to start all Ant builds but manages classpaths for tasks
etc on a per project basis. So we couldn't modify the Ant startup script to
include various versions of 3rd party libraries without breaking classpath
requirements for some projects.

I have experimented with moving*, and into their own jar that is not
housed in the ANT_HOME\lib directory. Doing so and including this new jar on
the classpath for the mapper and taskdef would appear to work. I have not
come across any areas yet where it causes a failure in any case. But its a
bit of a hack and requires a long winded mapper definition each time so its
not optimal.

Does anyone have a better solution?
Or even know if my soluiton has some fatal flaw?

The problem really seems to be that the RegExp implementations (among other
things) need to be both configurable but also reside in the same classloader
as the various standard Ant classes that load them.

Thanks in advance,

William Ferguson
Technical Lead - Workflow Functionality
Versata, Inc. "Business Logic Development and Management"

View raw message