Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 52131 invoked from network); 29 Dec 2006 14:16:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Dec 2006 14:16:24 -0000 Received: (qmail 21477 invoked by uid 500); 29 Dec 2006 14:16:30 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 21331 invoked by uid 500); 29 Dec 2006 14:16:29 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 21320 invoked by uid 500); 29 Dec 2006 14:16:29 -0000 Received: (qmail 21317 invoked by uid 99); 29 Dec 2006 14:16:29 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Dec 2006 06:16:29 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Dec 2006 06:16:21 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 3C7B71A981A; Fri, 29 Dec 2006 06:15:28 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r491018 - in /ant/core/trunk: WHATSNEW docs/manual/CoreTasks/whichresource.html src/main/org/apache/tools/ant/taskdefs/WhichResource.java Date: Fri, 29 Dec 2006 14:15:28 -0000 To: ant-cvs@apache.org From: peterreilly@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061229141528.3C7B71A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: peterreilly Date: Fri Dec 29 06:15:27 2006 New Revision: 491018 URL: http://svn.apache.org/viewvc?view=rev&rev=491018 Log: Bugzilla 41158: add classpathref to Modified: ant/core/trunk/WHATSNEW ant/core/trunk/docs/manual/CoreTasks/whichresource.html ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/WhichResource.java Modified: ant/core/trunk/WHATSNEW URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?view=diff&rev=491018&r1=491017&r2=491018 ============================================================================== --- ant/core/trunk/WHATSNEW (original) +++ ant/core/trunk/WHATSNEW Fri Dec 29 06:15:27 2006 @@ -28,6 +28,9 @@ * add errorProperty and updatedProperty to Bugzilla 35637 and 28941. +* add classpathref attribute to + Bugzilla 41158. + Changes from Ant 1.6.5 to Ant 1.7.0 =================================== Modified: ant/core/trunk/docs/manual/CoreTasks/whichresource.html URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/whichresource.html?view=diff&rev=491018&r1=491017&r2=491018 ============================================================================== --- ant/core/trunk/docs/manual/CoreTasks/whichresource.html (original) +++ ant/core/trunk/docs/manual/CoreTasks/whichresource.html Fri Dec 29 06:15:27 2006 @@ -16,194 +16,105 @@ --> - - - Whichresource - Task - - - - - - - - - - - - - -
- - - -
- Whichresource - Task -
Find a class or resource on the supplied classpath, or the system classpath if none is supplied. -
- - - Apache Ant - -
-
- - - - - - - - - - -
 
- - - Description -
- Find a class or resource on the supplied classpath, or the system classpath if none is supplied. The named property is set if the item can be found. For example
 <whichresource resource="/log4j.properties" property="log4j.url" > 
-
- - - - - - - - - - - - - - -
 
- - - Parameters -
- - - - - - - - - - - - - - - - - - - - - - - + +
- Attribute - - Description - - Type - - Requirement -
- property - - the property to fill with the URL of the resource or class - - String - - Required -
- class - - name the class to look for - - String + + + + Whichresource Task + + + + + + +

Whichresource

+

Description

+

+ Find a class or resource on the supplied classpath, or the + system classpath if none is supplied. + The named property is set if the item can be found. + For example: +

+
+  <whichresource resource="/log4j.properties" property="log4j.url" >
+
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
property + The property to fill with the URL of the resource of class. + Yes
class + The name of the class to look for. + Exactly one of these.
resource + The name of the resource to look for. +
classpath + The classpath to use when looking up class + or resource. + No
classpathref + The classpath to use, given as a + reference + to a path defined elsewhere. + Since Ant 1.7.1. - Exactly one of these two -
- resource - - name the resource to look for - - String -
- classpath - - Set the classpath to be used for this compilation. - - Path - - Optional -
-
No
- - - - - - - - - - -
 
- - - Parameters as nested elements -
- - - - - -
 
- - classpath (org.apache.tools.ant.types.Path) -
- Adds a path to the classpath. - - - -
- - -
- - - -
- - +

Parameters specified as nested elements

+

classpath

+

+ Whichresource's classpath attribute is a + path-like structure and can also be + set via a nested <classpath> element. +

+

Examples

+

+ The following shows using a classpath reference. +

+
+  <path id="bsf.classpath">
+    <fileset dir="${user.home}/lang/bsf" includes="*.jar"/>
+  </path>
+  <whichresource property="bsf.class.location"
+                 class="org.apache.bsf.BSFManager"
+                 classpathref="bsf.classpath"/>
+  <echo>${bsf.class.location}</echo>
+
+

+ The following shows using a nested classpath. +

+
+  <whichresource
+    property="ant-contrib.antlib.location"
+    resource="net/sf/antcontrib/antlib.xml">
+    <classpath>
+      <path path="f:/testing/ant-contrib/target/ant-contrib.jar"/>
+    </classpath>
+  </whichresource>
+  <echo>${ant-contrib.antlib.location}</echo>
+
+ Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/WhichResource.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/WhichResource.java?view=diff&rev=491018&r1=491017&r2=491018 ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/WhichResource.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/WhichResource.java Fri Dec 29 06:15:27 2006 @@ -19,6 +19,7 @@ package org.apache.tools.ant.taskdefs; import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.Task; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; @@ -82,6 +83,15 @@ return classpath.createPath(); } + /** + * Set the classpath to use by reference. + * + * @param r a reference to an existing classpath. + * @since Ant 1.7.1 + */ + public void setClasspathRef(Reference r) { + createClasspath().setRefid(r); + } /** * validate --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org