Starting Ant with the lib option to specify a path to search for jars and classes isn't working in 1.6.1. The problem is in the /usr/bin/ant script, because ant is started by running Ant's traditional entry point. [snip from ant manual: http://ant.apache.org/manual/running.html#viajava] Ant can be started with two entry points: - java -Dant.home=c:\ant org.apache.tools.ant.Main [options] [target] - java -Dant.home=c:\ant org.apache.tools.ant.launch.Launcher [options] [target] The first method runs Ant's traditional entry point. The second method uses the Ant Launcher introduced in Ant 1.6. The former method does not support the -lib option and all required classes are loaded from the CLASSPATH. You must ensure that all required jars are available. At a minimum the CLASSPATH should include: * ant.jar and ant-launcher.jar * jars/classes for your XML parser * the JDK's required jar/zip files The latter method supports the -lib option and will load jars from the specified ANT_HOME. You should start the latter with the most minimal classpath possible, generally just the ant-launcher.jar. [snip end] Library Directories in Ant 1.6: http://ant.apache.org/manual/running.html#libs so i changed some lines of the gentoo-ant script to get it (for me) working: - removed the hardcoded classpath - starting ant using the new entrypoint #! /bin/bash # Copyright (c) 2001-2003 The Apache Software Foundation. All rights # reserved. # Edited for Gentoo Linux # $Header: /home/cvsroot/gentoo-x86/dev-java/ant/files/1.6.1/ant,v 1.1 2004/03/11 02:35:50 zx Exp $ if [ -f $HOME/.gentoo/java-env ] ; then source $HOME/.gentoo/java-env else JAVA_HOME=`java-config --jdk-home` CLASSPATH=`java-config --classpath`:${CLASSPATH} fi if [ -z $JAVA_HOME ] ; then echo "Error: No JDK found!" echo "Try using java-config script to set your JDK" echo "Remember that you need a JDK not a JRE" exit 1 fi # load system-wide ant configuration if [ -f "/etc/ant.conf" ] ; then . /etc/ant.conf fi # provide default values for people who don't use RPMs if [ -z "$rpm_mode" ] ; then rpm_mode=false; fi if [ -z "$usejikes" ] ; then usejikes=false; fi # load user ant configuration if [ -f "$HOME/.antrc" ] ; then . "$HOME/.antrc" fi ANT_HOME=/usr/share/ant # set ANT_LIB location ANT_LIB="${ANT_HOME}/lib" JAVACMD="`java-config --java`" if [ ! -x "$JAVACMD" ] ; then echo "Error: JAVA_HOME is not defined correctly." echo " We cannot execute $JAVACMD" exit 1 fi # copied from original ant script if [ -z "$LOCALCLASSPATH" ] ; then LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar else LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar:$LOCALCLASSPATH fi if [ -n "$JAVA_HOME" ] ; then if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar" fi if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip" fi else echo "Warning: JAVA_HOME environment variable is not set (or not exported)." echo " If build fails because sun.* classes could not be found" echo " you will need to set the JAVA_HOME environment variable" echo " to the installation directory of java." echo " Try using java-config script" fi # Allow Jikes support (off by default) if $usejikes; then ANT_OPTS="$ANT_OPTS -Dbuild.compiler=jikes" fi # 2002-11-02, karltk@gentoo.org: # The Blackdown JDK on PPC hiccups with native threads # if [ "`arch`" == "ppc" ] ; then export THREADS_FLAG="green" fi # copied from original ant script "$JAVACMD" $ANT_OPTS -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" org.apache.tools.ant.launch.Launcher $ANT_ARGS -lib "$CLASSPATH" "$@" ciao, tom. Reproducible: Always Steps to Reproduce: 1. ant -lib /home/ant/extras Actual Results: The Ant help text appears. Expected Results: Seraching for extra libaries in the specified directory and starting the build process. without jikes (USE="-jikes")
Thanks, fixed in portage ;)