Subject: pkg/29338: No method to load an external library with apache-ant package
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <posta@roberto.gianassi.name>
List: pkgsrc-bugs
Date: 02/11/2005 16:30:00
>Number:         29338
>Category:       pkg
>Synopsis:       No method to load an external library with apache-ant package
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 11 16:30:00 +0000 2005
>Originator:     Roberto Gianassi
>Release:        NetBSD 2.0 on i386
>Organization:
n/a
>Environment:
NetBSD gericom 2.0 NetBSD 2.0 (MYKERNEL) #1: Tue Jan  4 14:45:24 CET 2005  root@gericom:/usr/src/sys/arch/i386/compile/MYKERNEL i386

>Description:
I'm unable to load an external library with Apache Ant 1.6.2 package
>How-To-Repeat:
Try to put a JUnit or FTP task in one build file and then build the application: it will complain that at least one library file is missing.
>Fix:
I'm not a shell programming guru, but my hack may probably give you an hint on a possible solution.
I took the original ant script file (standard installation: I'm referring to the /usr/pkg/bin/ant file) and made some modifications to suit my needs.
In particular I've changed the DIRLIBS definition to include the needed libraries ($*_HOME variables are defined before this line to reflect my installation):

# add in the dependency .jar files
DIRLIBS="${JUNIT_HOME}/junit.jar ${ANT_HOME}/lib/ant-junit.jar ${COMMONS_NET_HOME}/commons-net-1.3.0.jar ${ANT_HOME}/lib/java/ant/ant-commons-net.jar ${ANT_HOME}/lib/java/ant/ant.jar ${ANT_HOME}/lib/java/ant/ant-nodeps.jar ${ANT_HOME}/lib/java/crimson.jar"

I propose the following solution:
define a "standard" directory ($HOME/lib/java/ant may be a good choice) in which the user may put dependency library files;
scan also that directory to build the LOCALCLASSPATH.

I don't know if this is difficult to do. It doesn't seem so and it will be very helpful for an effective ant use: if a user wants to use the junit task, for example, she only needs to put the ant-junit.jar and the junit.jar in the "standard" directory and rebuild.