Hi Damian, This is a design issue with RJB (ruby-java bridge) which affects AntWrap. All Java libraries used by Buildr must added to Java.classpath before Java.load is called. (Java.load is called automatically the first call to a Java class is made)
So you have two choices, 1) Add the following line to the top of your buildfile, Java.classpath << FileList[ENV['ANT_HOME'] + '/lib/*'] 2) Run ant as an external process, task :external_ant exec 'ant -f build.xml some_task' end Also, Buildr has some syntax sugar for creating AntProject using the ant() method within a project, ant('my-project') do |ant| ant.ant(:antfile => 'build.xml', :dir => '.', :target => 'compile') end (API doc at http://buildr.apache.org/rdoc/classes/Buildr/Ant.html) hope this helps, alex On Thu, Aug 25, 2011 at 9:14 AM, Damian Monogue <demon...@gmail.com> wrote: > Hello, > > I was hoping you kind folks could help me out. > > I'm attempting to reuse some of our old ant scripts in our current push to > implement buildr as our new build tool. I've been trucking along ok, but > now > I'm having issues with it not wanting to load all of the jars in > ANT_HOME/lib. > > I'm calling AntProject.new(:ant_home => "/home/dmonogue/apache-ant-1.6.5") > as /home/dmonogue/apache-ant-1.6.5 is where I exploded the 1.6.5 .tar.bz2 > distributed on the ant.apache.org site. everything chugs along great, > until > I get to a replaceregexp task, whereupon it blows up with the following: > > build.xml:916: Problem: failed to create task or type replaceregexp > Cause: the class org.apache.tools.ant.taskdefs.optional.ReplaceRegExp was > not found. > This looks like one of Ant's optional components. > Action: Check that the appropriate optional JAR exists in > -ANT_HOME/lib > -the IDE Ant configuration dialogs > > Do not panic, this is a common problem. > The commonest cause is a missing JAR. > > This is not a bug; it is a configuration problem > > > The ant-nodeps.jar file (which contains the > org.apache.tools.ant.taskdefs.optional.ReplaceRegExp classfile) exists in > /home/dmonogue/apache-ant-1.6.5/lib directory but is apparently not > actually > being loaded in any fashion which ant recognizes. I have tried also with > ant > 1.7.1 with the same results. > > It may be worth noting that I couldn't get any of the ant tasks to work > until I added > > Java.load > > to the top of my buildfile, as it was then dying on such things as: > > NoClassDefFoundError : org/apache/tools/ant/DefaultLogger > > > I only even tried the Java.load because I found something in the > documentation which mentioned it for using external java libraries with > buildr, and I figured it couldn't hurt to try it. > > Is there something obvious I've overlooked? This is the last major hurdle > in > proving we can use buildr for our build tool here, so any help at all is > appreciated. > > Thanks, > Damian >