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

Carolyn Ann picture Carolyn Ann · Sep 26, 2012 · Viewed 43.8k times · Source

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

Answer

Gaurav picture Gaurav · Sep 26, 2012

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.