ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scot P. Floess" <>
Subject Re: Libraries for optional tasks defined from within build.xml
Date Sat, 15 Dec 2007 17:22:25 GMT
If memory serves, there is an issue with Ant 1.7 and specifying a lib 
dir...  Ant 1.7.1 fixes the problem...  I assume 1.7.1+ fixes it too :)  
I had to build that from source...

Then all you should have to do is use the <classpath> child element of 
<scriptdef>.  For example:

        name        = "compute-locale"
        language    = "beanshell"
        description = "Sets the locale of the current JVM."
        uri         = "" >

            <path  refid = "jplate.LIB_PATH_REF"/>

        <attribute  name = "property"/>

            project.setProperty ( attributes.get ( "property" ), 
java.util.Locale.getDefault ().toString () );

Klaus Malorny wrote:
> Hi,
> sorry if this is a newbie question, but I did not find an answer in 
> docs, faqs, google etc.
> I'm using Ant 1.7, and I would like to use the <script> and 
> <scriptdef> tasks to solve a particular problem. Since these are 
> optional tasks, they need various libraries when run under Java5. So 
> far, I was able to run a little "hello world" script. But what really 
> bothers me is that I either have to copy the libraries into my ant 
> installation or have to use the "-lib" option for each of the three 
> libraries. As I want to distribute the project and as it shall be 
> platform independent, writing a shell script or a Windows batch file 
> is not really the solution I imagine. I would prefer to reference the 
> libraries from within the build.xml file, like it is done with 
> <typedef>/<taskdef> for external tasks. Trying to use the <typedef>

> mechanism for this purpose failed; An attempt to override the "script" 
> task results in an error "Trying to override old definition of task 
> script"; choosing a different name reveals that the libraries are not 
> found despite being referenced (maybe ant uses a different class 
> loader for that purpose).
>    <path id="lib.path">
>       <fileset dir="lib" includes="**/*.jar"/>
>     </path>
>     <typedef
>       name="scriptx"
>       classname=""
>       classpathref="lib.path"/>
> Any help is highly appreciated.
> Klaus
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate
Chief Architect JavaPIM
QA Engineer OpenQabal

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message