ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Raible" <mrai...@gmail.com>
Subject Re: Is it possible to use <script> without putting JARs in $ANT_HOME/lib?
Date Wed, 05 Apr 2006 02:17:05 GMT
Nevermind, I solved this with an Ant Task I found in the Antelope project.

        <stringutil string="${object.name}" property="remainder">
            <substring beginindex="1"/>
        </stringutil>
        <stringutil string="${object.name}" property="char1">
            <substring endindex="1"/>
        </stringutil>
        <stringutil string="${char1}" property="upperChar1">
            <uppercase/>
        </stringutil>
        <stringutil string="${char1}" property="lowerChar1">
            <lowercase/>
        </stringutil>
        <property name="model.name" value="${upperChar1}${remainder}"/>
        <property name="model.name.lowercase"
value="${lowerChar1}${remainder}"/>

Thanks,

Matt

On 4/4/06, Matt Raible <mraible@gmail.com> wrote:
> I'd like to use the <script> task without putting bsf.jar and js.jar
> in ANT_HOME/lib.  Is that possible?
>
> I tried the following, but no dice:
>
>         <taskdef name="foo"
> classname="org.apache.tools.ant.taskdefs.optional.Script">
>                 <classpath>
>                         <fileset dir="${ant-contrib.dir}" includes="*.jar"/>
>                 </classpath>
>         </taskdef>
>
>                 <!-- Using Javascript functions to capitalize and lowercase the model.name
-->
>          <foo language="javascript"><![CDATA[
>
>              // getting the value
>              lowercaseValue = project.getProperty("object.name");
>
>              // the first character
>              low = lowercaseValue.substring(0,1).toLowerCase();
>
>              // the rest of the value
>              rest = lowercaseValue.substring(1);
>
>             // convert first character to uppercase
>              up = low.toUpperCase();
>
>              // concatenate the uppercase with the rest
>              uppercaseValue = up + rest;
>              lowercaseValue = low + rest;
>
>              // store the result in a new property
>              project.setProperty("model.name",uppercaseValue);
>              project.setProperty("model.name.lowercase", lowercaseValue);
>
>          ]]></foo>
>     </target>
>
> I get:
>
> BUILD FAILED
> java.lang.NoClassDefFoundError: org/apache/bsf/BSFException
>
> If I move js.jar and bsf.jar in $ANT_HOME/lib, everything works fine.
> The main reason I want to keep the JARs in my project is because 1) I
> don't want users to go through an extra "copy JARs into ANT_HOME/lib
> step", and 2) I'm using Canoo WebTest uses a newer version of js.jar
> (the latest version of rhino) and I don't want the conflict.
>
> Thanks,
>
> Matt
>

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


Mime
View raw message