ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott W. Ruch" <sr...@inventa.com>
Subject Customizing classpath for Ant's Script task
Date Thu, 23 Sep 2004 21:17:40 GMT

We've just upgraded to 1.6.2 and in the process we're
trying to tighten-up things up a bit.  The new policy
is that all widely-used 3rd-party libraries are placed 
in ANT_HOME/lib for all scripts to access.  We have a few
Ant scripts that employ Javascript via the Script task with
BSF & Rhino, so we put those jars in $ANT_HOME/lib as well.

The problem is that certain scripts need additional
jars for use in Javascript - and those we don't want
to put in $ANT_HOME/lib since they are our own build 
products.

Before we switched over to 1.6.2 and keeping the 3rd
party libs in $ANT_HOME/lib, we used to set up
the classpath for the Script task like this:

      <path id="tools.classpath">
         <fileset dir="../lib/ant">
            <include name="bsf.jar"/>
            <include name="js.jar"/>
            <include name="optional.jar"/>
         </fileset>
         <fileset dir="../lib">
            <include name="our-private.jar"/>
            <include name="log4j*.jar"/>
         </fileset>
      </path>

      <taskdef name="script"
         classpathref="tools.classpath"
         classname="org.apache.tools.ant.taskdefs.optional.Script"/>

Now that some of the jars are in $ANT_HOME/lib, we're trying
to do this:

      <path id="tools.classpath">
         <fileset dir="../lib">
            <include name="our-private.jar"/>
         </fileset>
      </path>

      <taskdef name="script"
         classpathref="tools.classpath"
         classname="org.apache.tools.ant.taskdefs.optional.Script"/>

But no matter how we attempt to craft the classpath, Ant
will not load the classes in "our-private.jar" and hence 
the javascript eventually fails.

We've also tried setting different values of "build.sysclasspath",
but that has no effect on this behavior.

Short of writing our own custom Script task - or putting our
private jars in $ANT_HOME/lib, is there any way around this?

Thanks,

Scott


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message