Failed to load definitions from resource network /sf/antcontrib/antlib.xml, netbeans

I am new to Netbeans and new to (less than a year) for programming Ruby. I'm getting more frustrated with Eclipse and Ruby - it doesn't look like a Mac at all! - and decided, based on the recommendation in "Using JRuby", to try Netbeans.

After several blog posts, specifically the Geertjan post , everything is set up for me (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) is build.xml:

 <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; jar file, I just can't find anywhere. I asked on the Geertjan blog, and I thought I was asking here. I tried different things - it took me a while to figure out that Netbeans was using its own Java and Ant! - and $ ANT_HOME is undefined, but nothing I'm trying seems to work. I know that I missed something simple, but I can’t understand what it can be!

I am running OS X Mountain Lion with Netbeans 7.2 (build 201207171143). I uploaded NB Ruby to "~ / Downloads / mercurial / NB Ruby".

Thank you in advance for your help! :-)

Thanks @TarjusArjun!

Once you find ant -contrib-1.0b3.jar ( I found it here ), you need to copy it to:

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

If your installation is similar to mine, you get a bunch of new errors and a failed build, but this is another problem.

(Thanks, Jav_Rock, for editing the link. :-) I completely forgot about it!)

+6
source share
4 answers

Perhaps your root problem is that the NetBeans IDE does not select ANT_HOME. ANT is shipped to the NETBEANS IDE at this location: <<NETBEANSHOME>>/java/ant . You can try placing ant-contrib-1.0b3.jar in this place.

+5
source

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

 <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> 
+1
source

Netbeans documentation recommends placing antlib in the 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, antlib is placed in mytask.jar and is referred to as part of the taskdef class path. This approach is independent of ANT_HOME and user-specific directories.

0
source

You cannot use the 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"/> 
0
source

Source: https://habr.com/ru/post/926255/


All Articles