ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ekta goel" <>
Subject ivy:cachepath is not bound
Date Tue, 23 Oct 2007 07:45:53 GMT
Thanks jacob, for your reply to query "content is not allowed in prolog".
Thanks Jan, for your reply.

That problem is fixed, as when we download build.xml from site(quick
"-" tags and blank spaces are there, that gives the problem.

But now I am trapped in another problem, when I run that build.xml, I got
problem " the prefix "ivy" for the element "ivy:cachepath" is not bound.".
and build get failed.

Please help me.
Thanks in advance



   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at

   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.

    <project name="go-ivy" default="go">


        this build file is a self contained project: it doesn't require
anything else
        that ant 1.6.2 or greater and java 1.4 or greater properly

        It is used to showcase how easy and straightforward it can be to use

        This is not an example of the best pratice to use in a project,
        for the java source code "generation" :-) (see generate-src target)

        To run copy this file in an empty directory, open a shell or a
command window
        in this directory and run "ant". It will download ivy and then use
it to resolve
        the dependency of the class which is itself "contained" in this
build script.

        After a successful build run "ant" again and you will see the build
will be
        much faster.

        More information can be found at


 here is the version of ivy we will use. change this property to try a newer

         version if you want
<property name="ivy.install.version" value="1.4.1"/>
<property name="ivy.jar.dir" value="${basedir}/ivy"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<property name="build.dir" value="build"/>
<property name="src.dir" value="src"/>

          target: install-ivy
            this target is not necessary if you put ivy.jar in your ant lib
            if you already have ivy 1.4 in your ant lib, you can simply
remove this
            target and the dependency the 'go' target has on it

    <target name="install-ivy" description="--> install ivy">
<mkdir dir="${ivy.jar.dir}"/>

 download Ivy from web site so that it can be used even without any special
<echo message="installing ivy..."/>
<get src="C:\Documents and Settings\Administrator\Desktop\ivy-1.4.1.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>

 try to load ivy here from local ivy dir, in case the user has not already
              it into ant's lib dir (note that the latter copy will always
take precedence).
              We will not fail as long as local lib dir exists (it may be
empty) and
              ivy is in at least one of ant's lib dir or the local lib dir.

    <path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
<taskdef resource="fr/jayasoft/ivy/ant/antlib.xml" uri="antlib:
fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>

          target: go
                    Go ivy, go!

    <target name="go" depends="install-ivy, generate-src" description="-->
resolve dependencies, compile and run the project">
<echo message="using ivy to resolve commons-lang 2.1..."/>

 here comes the magic line: asks ivy to resolve a dependency on
             commons-lang 2.1 and to build an ant path with it from its
<ivy:cachepath organisation="apache" module="commons-lang" revision="2.1"
pathid="" inline="true"/>
<echo message="compiling..."/>
<mkdir dir="${build.dir}"/>
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="


We are now ready to execute our simple program with its dependency on
Let's go!


    <java classname="example.Hello">

<path refid=""/>
<path location="${build.dir}"/>

          target: generate-src
            'Generates' the class source. It actually just echo a simple
            source code to a file. In real life this file would already be
            present on your file system, and this target wouldn't be

    <target name="generate-src">
<mkdir dir="${src.dir}/example"/>

    <echo file="${src.dir}/example/">

package example;

import org.apache.commons.lang.WordUtils;

public class Hello {
    public static void main(String[] args) {
        String  message = "hello ivy !";
        System.out.println("standard message : " + message);
        System.out.println("capitalized by " + WordUtils.class.getName()
                                + " : " + WordUtils.capitalizeFully


          target: clean

    <target name="clean" description="--> clean the project">

    <delete includeemptydirs="true">
<fileset dir="${src.dir}"/>
<fileset dir="${build.dir}"/>

          target: clean-ivy

    <target name="clean-ivy" description="--> clean the ivy installation">
<delete dir="${ivy.jar.dir}"/>

          target: clean-cache

    <target name="clean-cache" description="--> clean the ivy cache">
<delete dir="${user.home}/.ivy/cache"/>

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