Could not load definitions from resource net/sf/antcontrib/antlib.xml, netbeans
Asked Answered
P

5

8

I'm new to Netbeans, and newish (less than a year) to Ruby programming. I've been getting increasingly frustrated with Eclipse and Ruby - it's not at all Mac-like! - and decided, based on the recommendation in "Using JRuby", to try Netbeans.

Following a bunch of blog posts, notably Geertjan's post, I've got everything configured (I think), but I keep getting this error:

Could not load definitions from resource net/sf/antcontrib/antlib.xml. It could not be found.

The relevant part (again, I think) of build.xml is:

<taskdef resource="net/sf/antcontrib/antlib.xml">
    <classpath>
        <pathelement location="${binaries.cache}/943CD5C8802B2A3A64A010EFB86EC19BAC142E40-ant-contrib-1.0b3.jar"/>
    </classpath>
</taskdef>

binaries.cache points to /Users/carolyn/.hgexternalcache; the jar file, I just can't find anywhere. I've asked on Geertjan's blog, and I thought I'd ask here as well. I've tried a variety of different things - it took me awhile to figure out that Netbeans uses its own Java and Ant! - and $ANT_HOME isn't defined, but nothing I try seems to work. I know I'm missing something simple, but can't figure out what it might be!

I'm running OS X Mountain Lion, with Netbeans 7.2 (build 201207171143). I downloaded NB Ruby to "~/Downloads/mercurial/NB Ruby".

Thanks in advance for any help! :-)

Thanks @TarjusArjun!

Once you've found ant-contrib-1.0b3.jar (I found it here), it needs to be copied to:

/Applications/NetBeans/NetBeans 7.2.app/Contents/Resources/NetBeans/java/ant/lib

If your install is anything like mine, you then get a bunch of new errors and a failed build - but it's a different problem.

(Thanks, Jav_Rock, for the link edit. :-) I totally forgot about doing that!)

Precaution answered 25/9, 2012 at 22:14 Comment(1)
A similar question about eclipse and about pure ant: #15305345Soothsay
D
6

Perhaps your root problem lies that in the fact that the NetBeans IDE is not picking the ANT_HOME. ANT comes bundled within NETBEANS IDE at this location : <<NETBEANSHOME>>/java/ant. You can try by placing the ant-contrib-1.0b3.jar at this location.

Donetsk answered 26/9, 2012 at 9:37 Comment(1)
Carolyn, if it solved your problem, maybe you should consider the topic answered by @TejasArjun then?Repetend
A
1

It 's working for me with ubuntu. Copy and rename the file ant-contrib-1.0b3.jar to the path specified

<target name="downloadbinaries" description="Download external binaries not stored in Mercurial sources." depends="-taskdefs">
    <property file="${user.home}/.nbbuild.properties"/> <!-- permit binaries.cache to be overridden -->
    <property name="binaries.cache" location="${user.home}/.hgexternalcache"/>
    <property name="binaries.server" value="http://hg.netbeans.org/binaries/"/>
    <downloadbinaries cache="${binaries.cache}" server="${binaries.server}">
        <manifest dir=".">
            <include name="*/external/binaries-list"/>
        </manifest>
    </downloadbinaries>

    <taskdef resource="net/sf/antcontrib/antlib.xml">
        <classpath>
            <pathelement location="${binaries.cache}/**943CD5C8802B2A3A64A010EFB86EC19BAC142E40-ant-contrib-1.0b3.jar**"/>
        </classpath>
    </taskdef>
</target>
Akerboom answered 4/10, 2012 at 23:21 Comment(1)
My apologies! I totally missed your answer, athspk. :-( I'll give this a try in a wee while - I've resorted to Netbeans 6.9.1, but I'd really like to try the 7.2. Thanks, and again - sorry!Precaution
L
0

The Netbeans documentation recommends placing the antlib in a path relative to the project:

<project name="test" default="all" basedir=".">
    <target name="init">
        <javac srcdir="tasksource" destdir="build/taskclasses"/>
        <jar jarfile="mytasks.jar">
            <fileset dir="build/taskclasses"/>
        </jar>
        <taskdef name="customtask" classname="com.mycom.MyCustomTask">
            <classpath>
                 <pathelement location="mytasks.jar"/>
            </classpath>
        </taskdef>
    </target> 
</project>

In the above example, the antlib is placed in mytask.jar and referenced as part of the taskdef's classpath. This approach is independent of ANT_HOME and user-specific directories.

Limitary answered 17/3, 2013 at 3:15 Comment(0)
R
0

i'd like to share my answer that surely works after being trying for so long : it's just as so: copy the file(build-iml) where you've tried and worked somewhere else and replace the one declared above . one note: if you check the size you'll find big different for example the corrupt file (in my projects was 72 ) while the new one is 90k ... just try it soon and you will absolutely thank me.

Rotunda answered 13/2, 2019 at 21:9 Comment(0)
H
-1

You cannot use property in [taskdef]

sudo cp ant-contrib-1.0b3.jar /usr/local/lib/.

Then modify build.xml with

<pathelement location="/usr/local/lib/ant-contrib-1.0b3.jar"/>
Handbook answered 13/3, 2015 at 4:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.