Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!)

like image 555
Carolyn Ann Avatar asked Sep 25 '12 22:09

Carolyn Ann


2 Answers

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.

like image 58
Gaurav Avatar answered Nov 15 '22 23:11

Gaurav


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>
like image 38
damien Avatar answered Nov 15 '22 21:11

damien