Return-Path: Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 77964 invoked from network); 7 Feb 2003 04:54:15 -0000 Received: from unknown (HELO lago.versata.com.au) (192.207.36.98) by daedalus.apache.org with SMTP; 7 Feb 2003 04:54:15 -0000 Received: from retro.xedoc.com.au ([192.207.36.2]) by lago.versata.com.au (8.12.2/8.12.2) with ESMTP id h175IEYs006956 for ; Fri, 7 Feb 2003 16:18:15 +1100 (EST) Received: from Lucifer (dhcp60.xedoc.com.au [192.207.36.170]) by retro.xedoc.com.au (8.9.1/8.9.1) with SMTP id PAA02051 for ; Fri, 7 Feb 2003 15:52:26 +1100 (EST) From: "William Ferguson" To: "Ant User \(E-mail\)" Subject: replaceregexp Task and RegExp Mappers Date: Fri, 7 Feb 2003 15:52:24 +1100 Message-ID: <012501c2ce64$b5bb07e0$aa24cfc0@Lucifer> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 http://ant.apache.org/faq.html#delegating-classloader 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 org.apache.tools.ant.util.regexp.*, org.apache.tools.ant.util.RegexpPatternMapper and org.apache.tools.ant.types.RegularExpression 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"