You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Z W <mp...@gmail.com> on 2008/01/04 22:32:09 UTC

ant-contrib question

Hi Gurus

I'm trying to use tasks in ant-contrid.
So I downloaded ant-contrib-1.0b3-bin and put ant-contrib-1.0b3.jar file in
$ANT_HOME\lib

I also do the following


<?xml version="1.0"?>

<project name="test"

default="main"

xmlns:ac="antlib:net.sf.antcontrib">

 :

:



But I'm getting this error

[antlib:org.apache.tools.ant] Could not load definitions from resource
org/apach
e/tools/ant/antlib.xml. It could not be found.


I'm using Ant 1.7

Any help is appreciated.

Re: ant-contrib question

Posted by "Scot P. Floess" <fl...@mindspring.com>.
I agree too - this is an odd problem.  Here is what I tried:

I ran this on both Windows and Linux - it worked.

Here is the build.xml I was using:

<project default = "all" xmlns:ac="antlib:net.sf.antcontrib">

    <target name="all">
        <ac:if>
            <equals arg1 = "Scot"  arg2 = "Floess"/>

            <ac:then>
                <echo  message = "Sure does"/>
            </ac:then>

            <ac:else>
                <echo  message = "Sorry no dice"/>
            </ac:else>
        </ac:if>
    </target>
 </project>

I had a fresh install of Ant 1.7.0 and put ant-contrib-1.0b3.jar in 
$ANT_HOME/lib

A few things I'd look for:

    * Make sure, in fact the Ant contrib jar is in Ant's lib dir.
    * Make sure you don't have 2 versions of Ant installed.  By this I
      mean, you could have one version of Ant in /foo and another
      version in /bar.  You make changes to the version that lives in
      /bar.  However, the version that lives in /foo is the one in your
      path when calling the command "ant"

As Dominique pointed out, it does feel like a classpath issue.  That's 
why I say make sure you are affecting change to a version of Ant that is 
in your environment path.


Dominique Devienne wrote:
> On 1/4/08, Z W <mp...@gmail.com> wrote:
>   
>> I'm trying to use tasks in ant-contrid.
>> So I downloaded ant-contrib-1.0b3-bin and put ant-contrib-1.0b3.jar file in
>> $ANT_HOME\lib
>> [...]
>> xmlns:ac="antlib:net.sf.antcontrib">
>> [...]
>> [antlib:org.apache.tools.ant] Could not load definitions from resource
>> org/apache/tools/ant/antlib.xml. It could not be found.
>>     
>
> It's not complaining about Ant-Contrib's antlib.xml, but Ant's one,
> which is rather strange.
>
> Putting Ant-Contrib's jar in $ANT_HOME/lib and doing
> xmlns:ac="antlib:net.sf.antcontrib" should work (no need for a
> <taskdef>), so there's most likely something else at play, probably a
> classpath issue somehow... --DD
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>   

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim
Architect Keras          http://sourceforge.net/projects/keras
QA Engineer OpenQabal    http://openqabal.dev.java.net


Re: ant-contrib question

Posted by Dominique Devienne <dd...@gmail.com>.
On 1/4/08, Z W <mp...@gmail.com> wrote:
> I'm trying to use tasks in ant-contrid.
> So I downloaded ant-contrib-1.0b3-bin and put ant-contrib-1.0b3.jar file in
> $ANT_HOME\lib
> [...]
> xmlns:ac="antlib:net.sf.antcontrib">
> [...]
> [antlib:org.apache.tools.ant] Could not load definitions from resource
> org/apache/tools/ant/antlib.xml. It could not be found.

It's not complaining about Ant-Contrib's antlib.xml, but Ant's one,
which is rather strange.

Putting Ant-Contrib's jar in $ANT_HOME/lib and doing
xmlns:ac="antlib:net.sf.antcontrib" should work (no need for a
<taskdef>), so there's most likely something else at play, probably a
classpath issue somehow... --DD

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


Re: ant-contrib question

Posted by Peter Reilly <pe...@gmail.com>.
On Jan 4, 2008 9:32 PM, Z W <mp...@gmail.com> wrote:
> Hi Gurus
>
> I'm trying to use tasks in ant-contrid.
> So I downloaded ant-contrib-1.0b3-bin and put ant-contrib-1.0b3.jar file in
> $ANT_HOME\lib
>
> I also do the following
>
>
> <?xml version="1.0"?>
>
> <project name="test"
>
> default="main"
>
> xmlns:ac="antlib:net.sf.antcontrib">
>
>  :
>
> :
>
>
>
> But I'm getting this error
>
> [antlib:org.apache.tools.ant] Could not load definitions from resource
> org/apach
> e/tools/ant/antlib.xml. It could not be found.

This is currently always seen when verbose level logging is activated
- it is not a problem.


Just try to see if antcontrib is working.
<ac:if>
   <equals arg1="a" arg2="a"/>
   <then>
      <echo>Good!</echo>
  </then>
</ac:if>

Peter
>
>
> I'm using Ant 1.7
>
> Any help is appreciated.
>

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


Re: ant-contrib question

Posted by "Scot P. Floess" <fl...@mindspring.com>.
I think you need to do a taskdef...

Something like

<taskdef  resource="net/sf/antcontrib/antlib.xml"/>

Of course, you probably want to get your namespace inline...

Check the docs :)

Z W wrote:
> Hi Gurus
>
> I'm trying to use tasks in ant-contrid.
> So I downloaded ant-contrib-1.0b3-bin and put ant-contrib-1.0b3.jar file in
> $ANT_HOME\lib
>
> I also do the following
>
>
> <?xml version="1.0"?>
>
> <project name="test"
>
> default="main"
>
> xmlns:ac="antlib:net.sf.antcontrib">
>
>  :
>
> :
>
>
>
> But I'm getting this error
>
> [antlib:org.apache.tools.ant] Could not load definitions from resource
> org/apach
> e/tools/ant/antlib.xml. It could not be found.
>
>
> I'm using Ant 1.7
>
> Any help is appreciated.
>
>   

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim
QA Engineer OpenQabal    http://openqabal.dev.java.net


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