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 Martin Weber <m....@razorcat.com> on 2010/12/08 21:19:25 UTC

IvyDE: should not add ivy jar to ant class path in Eclipse

Hi all,

in our setup, we use an sftp resolver to publish to our company 
repository. That resolver need an additional jar (jsch.jar) on the ivy 
class path to work.
This works fine with the following Ant snippet:
     <taskdef resource="org/apache/ivy/ant/antlib.xml"
               uri="antlib:org.apache.ivy.ant">
       <classpath >
         <fileset dir="${generic.buildsys.dir}/lib-ivy">
           <include name="jsch*.jar" />
           <include name="ivy*.jar" />
         </fileset>
       </classpath>
     </taskdef>

But when I install the the IvyDE feature, it seems to add the ivy jar to 
ant's class path.
In our case, this leads to a situation, where the classpath of the above 
<taskdef> seems to be ignored and the jsch.jar is not found. Any 
subsequent <ivy:resolve> task will fail due to a ClassNotFoundException 
when Ant is invoked from within Eclipse. My guess is, that this is 
caused by Ant's class loader implementation as described here: 
<http://ant.apache.org/faq.html#delegating-classloader>.

Adding an appropriate <classpath> in the ivysettings file does not seem 
to have any effect.

Here's the ouptut from 'Ant -v' invoked from within Eclipse:

Without IvyDE:

-init-ivy:
fileset: Setup scanner in dir 
U:\develop\TRM-3.x-src\Buildtools\generic-buildsys\lib-ivy with 
patternSet{ includes: [jsch*.jar, ivy*.jar] excludes: [] }
parsing buildfile 
jar:file:/U:/develop/TRM-3.x-src/Buildtools/generic-buildsys/lib-ivy/ivy-2.0.0.jar!/org/apache/ivy/ant/antlib.xml 
with URI = 
jar:file:/U:/develop/TRM-3.x-src/Buildtools/generic-buildsys/lib-ivy/ivy-2.0.0.jar!/org/apache/ivy/ant/antlib.xml
Finding class org.apache.ivy.ant.IvyAntSettings
Loaded from 
U:\develop\TRM-3.x-src\Buildtools\generic-buildsys\lib-ivy\ivy-2.0.0.jar 
org/apache/ivy/ant/IvyAntSettings.class


With IvyDE 2.1.0 installed:

-init-ivy:
fileset: Setup scanner in dir 
U:\develop\TRM-3.x-src\Buildtools\generic-buildsys\lib-ivy with 
patternSet{ includes: [jsch*.jar, ivy*.jar] excludes: [] }
parsing buildfile 
jar:file:/D:/mehr%20Programme/eclipse/plugins/org.apache.ivy.eclipse.ant_2.2.0.final_20100923230623/ivy.jar!/org/apache/ivy/ant/antlib.xml 
with URI = 
jar:file:/D:/mehr%20Programme/eclipse/plugins/org.apache.ivy.eclipse.ant_2.2.0.final_20100923230623/ivy.jar!/org/apache/ivy/ant/antlib.xml
Class org.apache.ivy.ant.IvyAntSettings loaded from parent loader 
(parentFirst)
  +Datatype ivy:/razorcat.com:settings org.apache.ivy.ant.IvyAntSettings
...
[ivy:resolve] setting 'ivy.cache.resolution' to 
'C:\Users\m.weber\.ivy2/cache-resolv'
[ivy:resolve] setting 'ivy.cache.repository' to 
'C:\Users\m.weber\.ivy2/cache-repo'

BUILD FAILED
U:\develop\TRM-3.x-src\Buildtools\generic-buildsys\build-impl.xml:117: 
java.lang.NoClassDefFoundError: com/jcraft/jsch/JSchException


It would be useful, if at least the Ivy preferences in Eclipse would 
allow to disable the ivy.jar on Ant's class path, since this breaks 
Ivy's plugin loading mechanism.

Regards,
     Martin Weber


Re: IvyDE: should not add ivy jar to ant class path in Eclipse

Posted by Martin Weber <m....@razorcat.com>.
Am 10.12.2010 13:39, schrieb Nicolas Lalevée:
>
> Le 8 déc. 2010 à 21:24, Kirby Files a écrit :
>
>> Martin Weber wrote on 12/08/2010 03:19 PM:
>>> It would be useful, if at least the Ivy preferences in Eclipse
>>> would allow to disable the ivy.jar on Ant's class path, since
>>> this breaks Ivy's plugin loading mechanism.
>>
>> Please, though, let's not make such behavior the default. It took
>> long enough to get the ivy.jar contributed to ant; I'd hate to have
>> to go back to describing to our users how to set that up in Eclipse
>> again.
>
> I always found weird than the contributed ant tasks in Eclipse could
> not be unloaded by the end user. I don't think a preference will be
> implementable in IvyDE.

Hi Nicolas,

its not quite clear to we what the issue has to do with Eclipse's ant 
task (eclipse.assembel, etc I guess?).
But I see, my problem description was imprecise: I get the 
ClassNotFoundException, when I run Ant from within Eclipse via 'External 
Tools/Ant build'.
In a former post on this mailing list, I already complained about the CNFE.
The behaviour changed when I updated IvyDE from 
<http://hudson.zones.apache.org/hudson/view/Ant/job/IvyDE-updatesite/lastStableBuild/artifact/trunk/build> 
build 57 to build 106.


>
> I imagine that we would need here to split the Ivy feature into two
> one so the end user can select the Ivy-Ant plugin or not.
>
> Could you open a Jira issue about it Martin ?

Done. IVYDE-271. (Hope I attached enough information)


Martin

Re: IvyDE: should not add ivy jar to ant class path in Eclipse

Posted by Nicolas Lalevée <ni...@hibnet.org>.
Le 8 déc. 2010 à 21:24, Kirby Files a écrit :

> Martin Weber wrote on 12/08/2010 03:19 PM:
>> It would be useful, if at least the Ivy preferences in Eclipse would
>> allow to disable the ivy.jar on Ant's class path, since this breaks
>> Ivy's plugin loading mechanism.
> 
> Please, though, let's not make such behavior the default. It took long enough to get the ivy.jar contributed to ant; I'd hate to have to go back to describing to our users how to set that up in Eclipse again.

I always found weird than the contributed ant tasks in Eclipse could not be unloaded by the end user. I don't think a preference will be implementable in IvyDE.

I imagine that we would need here to split the Ivy feature into two one so the end user can select the Ivy-Ant plugin or not.

Could you open a Jira issue about it Martin ?

Nicolas


Re: IvyDE: should not add ivy jar to ant class path in Eclipse

Posted by Kirby Files <kf...@masergy.com>.
Martin Weber wrote on 12/08/2010 03:19 PM:
> It would be useful, if at least the Ivy preferences in Eclipse would
> allow to disable the ivy.jar on Ant's class path, since this breaks
> Ivy's plugin loading mechanism.

Please, though, let's not make such behavior the default. It took long 
enough to get the ivy.jar contributed to ant; I'd hate to have to go 
back to describing to our users how to set that up in Eclipse again.

   kirby