Peter,

You are a star - thanks very much for this... I followed your instructions and got it working!

This will go into release 1.1... Thanks!

https://rename-packages.dev.java.net/

Ben



>From: Peter Reilly <[EMAIL PROTECTED]>
>Reply-To: "Ant Users List" <user@ant.apache.org>
>To: Ant Users List <user@ant.apache.org>
>Subject: Re: Custom Ant Task with 3rd party library dependency
>Date: Tue, 03 May 2005 17:03:31 +0100
>MIME-Version: 1.0
>Received: from mail.apache.org ([209.237.227.199]) by mc6-f39.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 3 May 2005 09:56:47 -0700
>Received: (qmail 69893 invoked by uid 500); 3 May 2005 16:05:58 -0000
>Received: (qmail 69868 invoked by uid 99); 3 May 2005 16:05:57 -0000
>Received: neutral (hermes.apache.org: local policy)
>Received: from gate.corvil.net (HELO corvil.com) (213.94.219.177) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 03 May 2005 09:05:19 -0700
>Received: from [172.18.1.171] (angel.local.corvil.com [172.18.1.171])by corvil.com (8.13.3/8.13.3) with ESMTP id j43G3JJi098748for <user@ant.apache.org>; Tue, 3 May 2005 17:03:19 +0100 (IST)(envelope-from [EMAIL PROTECTED])
>X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
>Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
>Precedence: bulk
>List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
>List-Subscribe: <mailto:[EMAIL PROTECTED]>
>List-Help: <mailto:[EMAIL PROTECTED]>
>List-Post: <mailto:user@ant.apache.org>
>List-Id: "Ant Users List" <user.ant.apache.org>
>Delivered-To: mailing list user@ant.apache.org
>X-ASF-Spam-Status: No, hits=0.1 required=10.0tests=FORGED_RCVD_HELO
>X-Spam-Check-By: apache.org
>User-Agent: Mozilla Thunderbird 1.0 (X11/20041206)
>X-Accept-Language: en-us, en
>References: <[EMAIL PROTECTED]>
>X-Virus-Checked: Checked
>Return-Path: [EMAIL PROTECTED]
>X-OriginalArrivalTime: 03 May 2005 16:56:47.0216 (UTC) FILETIME=[17AA6700:01C55001]
>
>In your resource you should not set the classpath. Doing so will
>override the classpath given in the build file and cause ant to be
>confused.
>So just use:
> <antlib>
> <taskdef name="renamepackages"
>classname="org.appfuse.ant.RenamePackages"/>
></antlib>
>
>
>For example:
>src/testing/UseSpring.java:
>package testing;
>import org.springframework.beans.PropertyValue;
>import org.apache.tools.ant.Task;
>
>public class UseSpring extends Task {
> private PropertyValue pv = new PropertyValue("hello", "world");
> public void execute() {
> log("pv is " + pv);
> }
>}
>src/testing/antlib.xml:
><antlib>
> <taskdef name="usespring" classname="testing.UseSpring"/>
></antlib>
>
>build.xml:
><project name="testspring" default="use">
> <target name="jar">
> <mkdir dir="classes"/>
> <javac srcdir="src" destdir="classes"
>classpath="lib/spring.jar"/>
> <copy todir="classes">
> <fileset dir="src" includes="**/*.xml"/>
> </copy>
> <jar destfile="usespring.jar">
> <fileset dir="classes"/>
> </jar>
> </target>
>
> <target name="use" depends="jar">
> <typedef resource="testing/antlib.xml"
>classpath="usespring.jar:lib/spring.jar"/>
> <usespring/>
> </target>
></project>
>
>
>Outputs:
>Searching for build.xml ...
>Buildfile: /home/preilly/learning/a/spring/build.xml
>
>jar:
> [mkdir] Created dir: /home/preilly/learning/a/spring/classes
> [javac] Compiling 1 source file to
>/home/preilly/learning/a/spring/classes
> [copy] Copying 1 file to
>/home/preilly/learning/a/spring/classes
> [jar] Building jar:
>/home/preilly/learning/a/spring/usespring.jar
>
>use:
>[usespring] pv is PropertyValue: name='hello'; value=[world]
>
>Peter
>
>Ben Gill wrote:
>
>>Hi ,
>>
>>Yes I have tried that (well a variety of this type of thing) and it
>>is not working for me...
>>
>>In my 'main' build.xml file I do this:
>>
>><typedef resource="org/appfuse/ant/appfuse-contrib.xml"
>> classpath="spring.jar;rename-packages-1.0.jar"
>> uri="appfuse:/org.appfuse.ant"/>
>>
>>Then, in my appfuse-contrib.xml file I do:
>>
>><?xml version="1.0"?>
>><antlib>
>>
>> <taskdef name="renamepackages"
>> classname="org.appfuse.ant.RenamePackages"
>> classpath="spring.jar"
>> onerror="fail"/>
>>
>></antlib>
>>
>>But whatever I try setting either classpath to (or even if I use
>>inline classpath, or classpathref), my custom ant task cannot find
>>the spring classes..
>>
>>Is it possible what I am trying to do? Eric's article + other
>>postings I have read seem to suggest, the only two ways of using
>>3rd party classes from wthin a custom task is to ether a) kick off
>>a new JVM task or b) put the jars in the System classpath (ie.
>>ANT_HOME/lib)..
>>
>>Can anyone confirm either way??
>>
>>
>>
>>
>>
>>>From: Ivan Ivanov <[EMAIL PROTECTED]>
>>>Reply-To: "Ant Users List"
>><user@ant.apache.org>
>>>To: Ant Users List <user@ant.apache.org>
>>>Subject: Re: Custom Ant Task with 3rd party library dependency
>>>Date: Tue, 3 May 2005 07:01:41 -0700 (PDT)
>>>MIME-Version: 1.0
>>>Received: from mail.apache.org ([209.237.227.199]) by
>>mc4-f41.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 3
>>May 2005 07:25:53 -0700
>>>Received: (qmail 53754 invoked by uid 500); 3 May 2005 14:03:33
>>-0000
>>>Received: (qmail 53741 invoked by uid 99); 3 May 2005 14:03:32
>>-0000
>>>Received: pass (hermes.apache.org: local policy)
>>>Received: from web52910.mail.yahoo.com (HELO
>>web52910.mail.yahoo.com) (206.190.39.187) by apache.org
>>(qpsmtpd/0.28) with SMTP; Tue, 03 May 2005 07:03:32 -0700
>>>Received: (qmail 92243 invoked by uid 60001); 3 May 2005
>>14:01:42 -0000
>>>Received: from [212.95.183.130] by web52910.mail.yahoo.com via
>>HTTP; Tue, 03 May 2005 07:01:41 PDT
>>>X-Message-Info: JGTYoYF78jFXHutfHRffa3R5qXkgYW5muIU6wkBHhUc=
>>>Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
>>>Precedence: bulk
>>>List-Unsubscribe:
>><mailto:[EMAIL PROTECTED]>
>>>List-Subscribe: <mailto:[EMAIL PROTECTED]>
>>>List-Help: <mailto:[EMAIL PROTECTED]>
>>>List-Post: <mailto:user@ant.apache.org>
>>>List-Id: "Ant Users List" <user.ant.apache.org>
>>>Delivered-To: mailing list user@ant.apache.org
>>>X-ASF-Spam-Status: No, hits=0.0 required=10.0tests=
>>>X-Spam-Check-By: apache.org
>>>Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
>>>DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024;
>>d=yahoo.com;
>>b=hRifFK0n7F61CxssHDIcJp3K+/IJ98Ihh8+rbXJDk0osXoEzXjRUipoNSQW4NewMIiYwg/qaOtFAMDM6PMpORMjtGIkuIYAjaOUr73rgHa2PSma2ETrqsfojuM2s05Wt8DJkgzb+FD8PZp8al/NSiI6zOh5VcQoajS1LnpTcEXA=
>> ;
>>>X-Virus-Checked: Checked
>>>Return-Path:
>>[EMAIL PROTECTED]
>>>X-OriginalArrivalTime: 03 May 2005 14:25:53.0590 (UTC)
>>FILETIME=[0348B560:01C54FEC]
>>>
>>>Hello Ben,
>>>
>>>Have you tried with to <taskdef> your custom task with
>>>classpath nested tag:
>>><taskdef classname="org.myorg.MyTask">
>>> <classpath>
>>> <!-- location to your jars here -->
>>> </classpath>
>>></taskdef>
>>>
>>>HTH Ivan
>>>--- Ben Gill <[EMAIL PROTECTED]> wrote:
>>> > Hi,
>>> >
>>> > My custom Ant task relies on the Spring jar files,
>>> > but whatever I try, I get
>>> > a class not found exception..
>>> >
>>> > I read a lot of posts on this and saw Eric's article
>>> > here:
>>> >
>>> >
>>>http://www.fawcette.com/javapro/2003_02/magazine/features/ehatcher/
>>> >
>>> > But I cannot believe I have to spawn off a JVM to
>>> > pick up the spring jar's
>>> > do I?
>>> >
>>> > and I really dont want to force any user that uses
>>> > my task to copy the jar's
>>> > into their $ANT_HOME/lib...
>>> >
>>> > Has anyone got a nice, tidy way of making 3rd party
>>> > jar files available to a
>>> > custom task?
>>> >
>>> > Thanks
>>> >
>>> >
>>> >
>>> >
>>>---------------------------------------------------------------------
>>> > To unsubscribe, e-mail:
>>> > [EMAIL PROTECTED]
>>> > For additional commands, e-mail:
>>> > [EMAIL PROTECTED]
>>> >
>>> >
>>>
>>>
>>>
>>>__________________________________
>>>Do you Yahoo!?
>>>Yahoo! Small Business - Try our new resources site!
>>>http://smallbusiness.yahoo.com/resources/
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to