ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xavier Hanin" <xavier.ha...@gmail.com>
Subject Re: Problem: failed to create task or type antlib:org.apache.ivy.ant:retrieve
Date Fri, 18 Apr 2008 23:03:22 GMT
On Sat, Apr 19, 2008 at 12:45 AM, Trevin Beattie <tbeattie@boingo.com>
wrote:

> The AntClassLoader is extremely difficult to follow, especially since no
> source code is provided for sun.misc.URLClassPath.  At present my best
> guess is that the problem stems from a change made to
> org.apache.tools.ant.util.ClasspathUtils sometime in 2004:
>
>
> http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/ClasspathUtils.java?r1=276313&r2=277160&diff_format=h
>
> At startup, ant does find all of the jars in ~/.ant/lib/, appends them
> to the current class path, and stores the result back in the system
> java.class.path property.  In the old version of ant, a new class loader
> would be created using the system class path if an explicit path was not
> provided.  In the current version of ant, it does not default to the
> system class path; it defaults to null.  When it reaches
> org.apache.tools.ant.ComponentHelper to generate the task definition for
> antlib:org.apache.ivy.ant:retrieve, it cannot find the required resource
> "org/apache/ivy/ant/antlib.xml" and UnknownElement generates a
> BuildException.
>
> The class loader created in Launcher.run which contains the jars in
> ~/.ant/lib -- URLClassLoader -- is *not* the same as the class loader
> used by Typedef -- AntClassLoader2 -- when it's looking for the
> antlib.xml resource.
>
> I could be wrong though.  URLClassPath is all black magic to me.

I suggest forwarding this question to the ant-user mailing list, where Ant
gurus may be of better help in this area.

Xavier

>
>
> -- Trevin
>
> On Fri, 2008-04-18 at 11:35 -0700, Trevin Beattie wrote:
> > Bug #35060 appears to have the same symptoms that I'm seeing, but I
> > don't see the resolution for that bug.  The poster claims to have moved
> > ant.jar and ant-launcher.jar to /usr/share/java/ant/, but the classpath
> > in the second command line shows that he is still using the ones
> > in /usr/share/java/.  In any event, when I copy ant.jar and
> > ant-launcher.jar to /usr/share/java/ant on my system, it has no effect;
> > the build still fails.
> >
> > Another difference I noticed in the two command lines is that one puts
> > all of the jars in the -classpath option, while the other moves
> > everything except ant-launcher.jar over to the -cp option.  But that
> > didn't work for me either.  In fact, it didn't even work when I added
> > ivy-2.0.0-beta2.jar to -cp (either with the rest of the jars under -cp
> > or -classpath).  It only works when I add ivy-2.0.0-beta2.jar to the
> > -classpath option.
> >
> > I tried adding another external task to ~/.ant/lib/, and it didn't work
> > either.  I'm going to try debugging the ant launcher, though I have no
> > idea when it's supposed to load the jars...
> >
> > -- Trevin
> >
> > On Thu, 2008-04-17 at 23:20 -0700, Maarten Coene wrote:
> > > Can you use other tasks when you put them in your ~/.ant/lib, or do
> you have only problems with the ivy.jar?
> > > Maybe your problem is related to
> https://issues.apache.org/bugzilla/show_bug.cgi?id=35060 ?
> > >
> > > Maarten
> > >
> > > ----- Original Message ----
> > > From: Trevin Beattie <tbeattie@boingo.com>
> > > To: ivy-user@ant.apache.org
> > > Sent: Friday, April 18, 2008 12:44:43 AM
> > > Subject: Re: Problem: failed to create task or type
> antlib:org.apache.ivy.ant:retrieve
> > >
> > > On Thu, 2008-04-17 at 23:00 +0200, Jacob Grydholt Jensen wrote:
> > > > On 17/04/2008, Trevin Beattie <tbeattie@boingo.com> wrote:
> > > > > More details: I downloaded a fresh copy of the source tarballs of
> both
> > > > >  ant-1.6.2 and ant-1.6.5 from archive.apache.org, built them
> (without any
> > > > >  vendor patches), and ran the full command line for each,
> *without*
> > > > >  explicitly adding ivy on the classpath.  With ant-1.6.2, the
> build
> > > > >  succeeded.  With ant-1.6.5, the build failed.  So it looks like
> ivy is
> > > > >  incompatible with newer versions of ant.  (1.6.5 is 3 years old,
> BTW)
> > > >
> > > > I just tested 1.6.5 with 2.0.0-beta2 on Windows XP and it worked
> fine.
> > > > So it doesn't seem that ivy is incompatible with ant 1.6.5 in
> general.
> > > > But, it is strange that your combination of OS, ant and ivy does not
> > > > work. What is the output of ant -v (version 1.6.5 and ivy in
> > > > ~/.ant/lib)? I am also curious to see the value of ${user.home}.
> > > >
> > > > Best regards,
> > > > Jacob Grydholt Jensen
> > >
> > > I don't see user.home or any other properties in the '-v' output.  But
> > > `ant -diagnostics' shows me: "user.home : /home/tbeattie".  Here's the
> > > '-v' output:
> > >
> > > Apache Ant version 1.6.5 compiled on August 30 2006
> > > Buildfile: build.xml
> > > Detected Java version: 1.5 in: /usr/java/jdk1.6.0_03/jre
> > > Detected OS: Linux
> > > parsing buildfile
> /home/tbeattie/src/apache-ivy-2.0.0-beta2/src/example/hello-ivy/build.xml
> with URI =
> file:///home/tbeattie/src/apache-ivy-2.0.0-beta2/src/example/hello-ivy/build.xml
> > > Project base dir set to:
> /home/tbeattie/src/apache-ivy-2.0.0-beta2/src/example/hello-ivy
> > > Build sequence for target(s) `run' is [resolve, run]
> > > Complete build sequence is [resolve, run, report, clean, clean-cache,
> ]
> > >
> > > resolve:
> > >
> > > BUILD FAILED
> > >
> /home/tbeattie/src/apache-ivy-2.0.0-beta2/src/example/hello-ivy/build.xml:38:
> Could not create task or type of type: antlib:org.apache.ivy.ant:retrieve.
> > >
> > > Ant could not find the task or a class this task relies upon.
> > >
> > > This is common and has a number of causes; the usual
> > > solutions are to read the manual pages then download and
> > > install needed JAR files, or fix the build file:
> > >  - You have misspelt 'antlib:org.apache.ivy.ant:retrieve'.
> > >    Fix: check your spelling.
> > >  - The task needs an external JAR file to execute
> > >      and this is not found at the right place in the classpath.
> > >    Fix: check the documentation for dependencies.
> > >    Fix: declare the task.
> > >  - The task is an Ant optional task and the JAR file and/or libraries
> > >      implementing the functionality were not found at the time you
> > >      yourself built your installation of Ant from the Ant sources.
> > >    Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to
> the
> > >      task and make sure it contains more than merely a
> META-INF/MANIFEST.MF.
> > >      If all it contains is the manifest, then rebuild Ant with the
> needed
> > >      libraries present in ${ant.home}/lib/optional/ , or
> alternatively,
> > >      download a pre-built release version from apache.org
> > >  - The build file was written for a later version of Ant
> > >    Fix: upgrade to at least the latest release version of Ant
> > >  - The task is not an Ant core or optional task
> > >      and needs to be declared using <taskdef>.
> > >  - You are attempting to use a task defined using
> > >     <presetdef> or <macrodef> but have spelt wrong or not
> > >    defined it at the point of use
> > >
> > > Remember that for JAR files to be visible to Ant tasks implemented
> > > in ANT_HOME/lib, the files must be in the same directory or on the
> > > classpath
> > >
> > > Please neither file bug reports on this problem, nor email the
> > > Ant mailing lists, until all of these causes have been explored,
> > > as this is not an Ant bug.
> > >     at
> org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownElement.java:493)
> > >     at
> org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:391)
> > >     at
> org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:158)
> > >     at org.apache.tools.ant.Task.perform(Task.java:363)
> > >     at org.apache.tools.ant.Target.execute(Target.java:341)
> > >     at org.apache.tools.ant.Target.performTasks(Target.java:369)
> > >     at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
> > >     at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
> > >     at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
> > >     at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
> > >     at org.apache.tools.ant.Main.runBuild(Main.java:668)
> > >     at org.apache.tools.ant.Main.startAnt(Main.java:187)
> > >     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
> > >     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
> > >
> > > Total time: 0 seconds
> >
>
>


-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message