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:

   <scriptdef
       name        = "compute-locale"
       language    = "beanshell"
       description = "Sets the locale of the current JVM."
       uri         = "http://jplate.sourceforge.net/environment"; >

       <classpath>
           <path  refid = "jplate.LIB_PATH_REF"/>
       </classpath>

       <attribute  name = "property"/>

       <![CDATA[
project.setProperty ( attributes.get ( "property" ), java.util.Locale.getDefault ().toString () );
       ]]>
   </scriptdef>



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="org.apache.tools.ant.taskdefs.optional.Script"
      classpathref="lib.path"/>

Any help is highly appreciated.

Klaus


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

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

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim
QA Engineer OpenQabal    http://openqabal.dev.java.net


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to