You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Mitch Gitman <mg...@gmail.com> on 2008/12/19 06:59:31 UTC

trying to Ivy-fy the Ant script task

I'm trying to do some inline Ant scripting via the Ant *script
*task<http://ant.apache.org/manual/OptionalTasks/script.html>.
The same could go for the Ant *scriptdef
*task<http://ant.apache.org/manual/OptionalTasks/scriptdef.html>
.

And I'm trying to make Ivy be the provider of all the libraries on which the
*script *task depends. That works with the Bean Scripting Framework (BSF)
JAR (for the common scripting API), and the BSF implementation I'm using--in
this case, beanshell. But it isn't working for commons-logging.jar, on which
BSF depends. If I make my bsf/bsf module depend on
org.apache/commons-logging, the dependency gets dowloaded into my Ivy cache,
but I see the following error:
BUILD FAILED
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
        at org.apache.bsf.BSFManager.<init>(BSFManager.java:102)
        at
org.apache.tools.ant.util.optional.ScriptRunner.createManager(ScriptRunner.java:170)
...
Caused by: java.lang.ClassNotFoundException:
org.apache.commons.logging.LogFactory
        at
org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1400)
        at
org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1341)
        at
org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1088)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        ... 20 more

The only way I can get this *ClassNotFoundException *to go away is if I put
the commons-logging JAR in *USER_HOME*/.ant/lib or *ANT_HOME*/lib. Any ideas
how I can make this *AntClassLoader *use the commons-logging JAR provided by
Ivy?

Re: trying to Ivy-fy the Ant script task

Posted by Mitch Gitman <mg...@gmail.com>.
Just to wrap up, I may have to file this one in the unsolved mysteries bin.
The commons-logging dependency is now getting picked up, without the JAR
getting copied to *USER_HOME*/.ant/lib. I could swear I made no relevant
changes to the relevant Ivy files, but the only rational explanation I can
give for this working now is that somehow I did.

Consider the original query a false alarm.

On Fri, Dec 19, 2008 at 4:26 PM, Mitch Gitman <mg...@gmail.com> wrote:

> Just had a "Well duh, no kidding" moment. I'm used to using the *ivy:cachepath
> *task for establishing my classpaths from Ivy. But there's nothing
> stopping me from doing an *ivy:retrieve *in addition where the destination
> is the destination pattern would go like so:
> pattern="${user.home}/.ant/lib/[artifact].[ext]
>
> I tried to set the configuration so that only the commons-logging JAR gets
> copied over.
>
>
> On Thu, Dec 18, 2008 at 9:59 PM, Mitch Gitman <mg...@gmail.com> wrote:
>
>> I'm trying to do some inline Ant scripting via the Ant *script *task<http://ant.apache.org/manual/OptionalTasks/script.html>.
>> The same could go for the Ant *scriptdef *task<http://ant.apache.org/manual/OptionalTasks/scriptdef.html>
>> .
>>
>> And I'm trying to make Ivy be the provider of all the libraries on which
>> the *script *task depends. That works with the Bean Scripting Framework
>> (BSF) JAR (for the common scripting API), and the BSF implementation I'm
>> using--in this case, beanshell. But it isn't working for
>> commons-logging.jar, on which BSF depends. If I make my bsf/bsf module
>> depend on org.apache/commons-logging, the dependency gets dowloaded into my
>> Ivy cache, but I see the following error:
>> BUILD FAILED
>> java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
>>         at org.apache.bsf.BSFManager.<init>(BSFManager.java:102)
>>         at
>> org.apache.tools.ant.util.optional.ScriptRunner.createManager(ScriptRunner.java:170)
>> ...
>> Caused by: java.lang.ClassNotFoundException:
>> org.apache.commons.logging.LogFactory
>>         at
>> org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1400)
>>         at
>> org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1341)
>>         at
>> org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1088)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>>         ... 20 more
>>
>> The only way I can get this *ClassNotFoundException *to go away is if I
>> put the commons-logging JAR in *USER_HOME*/.ant/lib or *ANT_HOME*/lib.
>> Any ideas how I can make this *AntClassLoader *use the commons-logging
>> JAR provided by Ivy?
>>
>
>

Re: trying to Ivy-fy the Ant script task

Posted by Mitch Gitman <mg...@gmail.com>.
Just had a "Well duh, no kidding" moment. I'm used to using the *ivy:cachepath
*task for establishing my classpaths from Ivy. But there's nothing stopping
me from doing an *ivy:retrieve *in addition where the destination is the
destination pattern would go like so:
pattern="${user.home}/.ant/lib/[artifact].[ext]

I tried to set the configuration so that only the commons-logging JAR gets
copied over.

On Thu, Dec 18, 2008 at 9:59 PM, Mitch Gitman <mg...@gmail.com> wrote:

> I'm trying to do some inline Ant scripting via the Ant *script *task<http://ant.apache.org/manual/OptionalTasks/script.html>.
> The same could go for the Ant *scriptdef *task<http://ant.apache.org/manual/OptionalTasks/scriptdef.html>
> .
>
> And I'm trying to make Ivy be the provider of all the libraries on which
> the *script *task depends. That works with the Bean Scripting Framework
> (BSF) JAR (for the common scripting API), and the BSF implementation I'm
> using--in this case, beanshell. But it isn't working for
> commons-logging.jar, on which BSF depends. If I make my bsf/bsf module
> depend on org.apache/commons-logging, the dependency gets dowloaded into my
> Ivy cache, but I see the following error:
> BUILD FAILED
> java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
>         at org.apache.bsf.BSFManager.<init>(BSFManager.java:102)
>         at
> org.apache.tools.ant.util.optional.ScriptRunner.createManager(ScriptRunner.java:170)
> ...
> Caused by: java.lang.ClassNotFoundException:
> org.apache.commons.logging.LogFactory
>         at
> org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1400)
>         at
> org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1341)
>         at
> org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1088)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>         ... 20 more
>
> The only way I can get this *ClassNotFoundException *to go away is if I
> put the commons-logging JAR in *USER_HOME*/.ant/lib or *ANT_HOME*/lib. Any
> ideas how I can make this *AntClassLoader *use the commons-logging JAR
> provided by Ivy?
>