On 12/27/06, Stephen Nesbitt <[EMAIL PROTECTED]> wrote:
All:

I'm trying to figure out if something is possible or if I am just being
clueless.

I have written a couple of tasks using jython and scriptdef. Becuase they
are jython and white case is significant, the jython scripts are in files
referenced by the src attribute rather than included in the scripdef
itself.

I could make these available to builds that need them by using the import
mechanism. However it seems to me to be more elegant to use the antlib
mechanism.

However I can't figure out how to use the antlib mechanism with a
scriptdef element (or even if it is possible under 1.6.5). Does the
antlib.xml need to be in a jar? or can they live in an exploded
directory? How do I inform Ant where the implementing scripts live?

I have tried this by creating an jar having only a single antlib.xml. And
I can even get the build file to recognize it. But I am also seeing funny
results. For instance a single "print attributes" statment is invoked
twice with the attributes collection correct in the first invocation and
empty in the second.

This looks like a bug, try to get a small self contained example.

The antlib.xml can be assessed directly, or in a jar or in an
exploded directory. For autloload in $ANT_HOME/lib or -lib command
line option, it needs to be in a jar file.

<typedef file="antlib.xml"/>
<typedef resource="a/b/c/antlib.xml" classpath="my-path"/>

To access a script file, you need to use an absolute file name, a relative
filename will not work, I would advise putting the scripts inline in the
scriptdefs. (Use a non white space significient scripting language ;)
ruby, groovy, javascript, or beanshell).



Am I barking up the wrong tree here? What would be the best way to
distribute these scriptdef tasks?
In a jar file. - however, an issue is the available of a scripting language
in the target machines. The antlib mechanism does not allow the embedding
of a scripting engine jar in the antlib jar.

On java6 and ant.1.7.0, one can use the javascript language in java6.

Peter


-steve

--


Stephen Nesbitt
CM Architect/Lead
The Cobalt Group
[EMAIL PROTECTED]
x8271

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



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

Reply via email to