Ruby in NetBeans IDE 7.2

I've not so far managed to get commit access to the Ruby community plugin repo, so here are instructions for upgrading it to 7.2 for someone who does have the rights to do so.

Note: For those who don't care about the gory details, i.e., who simply want to use Ruby in NetBeans IDE 7.2, go to the Plugin Manager in NetBeans IDE 7.2, and register  https://blogs.oracle.com/geertjan/resource/nb-72-community-ruby.xml  as a new update center. Though the update center is, as you can see, in this blog, the NBMs that will be available once you've registered the update center are located at java.net.

  1. Check out the community Ruby plugin:

    http://hg.netbeans.org/community-ruby

  2.  Open the Ruby plugin project:



  3. Build the project. This takes a while because many NetBeans modules in NBM format need to be downloaded. While you wait, read issue 210334, which describes the reason why the plugin will not work out of the box in 7.2, after which you should read http://hg.netbeans.org/web-main/rev/106cf094a505, which shows how other plugins in NetBeans IDE needed to be changed because of issue 210334.

  4. At some stage in your life, the NBMs will be downloaded and the compilation process will throw up this error, which makes complete sense, once you've read the issue referred to in the previous step:
    No dependent module org.netbeans.modules.web.client.tools.api
  5. Now we're going to tweak the plugin here and there so that we're not depending on the dead "org.netbeans.modules.web.client.tools.api" (hereafter referred to as "the WCTA", for "the Web Client Tools API") module anymore, as well as few other tweaks that turned out to be needed for 7.2.
    • Open "Ruby on Rails Project Support". In the Important Files node, open "Project Metadata". Look for the WCTA dependency and delete it. Open "RailsActionProvider" and delete the two import statements that come from the WCTA. Comment out the else-clause at line 629. Open "RailsUrlDisplayer" and delete the 6 import statements that come from WCTA. Comment out the if-clause at line 97. Comment out definition and usage of "LocationMapperfactory" from line 108 onwards. Remove two obsolete catch clauses at the end of the class. Now the module can be built without a problem.

    • Expand the "NB Ruby" project. Here, we're not going to change anything within a specific module. Instead, we're going to remove a module completely from the application. The module is "Ruby Test Runner", which makes use of a lot of code from "org.netbeans.modules.gsf.testrunner",  which no longer exists. I suspect that the Ruby plugin hasn't made use of this module for a long time and that, i.e., it has been dead functionality for quite some time, though I could be wrong, of course. Open the "project.properties" file in the Important Files node of the NB Ruby project. In there, on line 27, delete the reference to "ruby.testrunner". Now the module will be excluded from the build process.

    • Open "Ruby and Rails". In the Important Files node, open "Project Metadata" and remove the dependency on "org.netbeans.modules.ruby.testrunner". 

    • Open "GlassFish Server 3 - Ruby". In the "JRubyServerModule" class, two usages of a method "startServer" expect two arguments, now, instead of one. For the second argument, pass in "null" and then build the module and it will compile correctly.

Now everything compiles and you can run the Ruby plugin! And, those few tweaks don't add up to very much work, do they? Based on the changes made above, I don't think any functionality has been impacted, though, again, feel free to disagree. Have fun with the great Ruby support that the community Ruby plugin provides for NetBeans IDE 7.2!

Comments:

Thanks for this Geertjan, this is exactly what i was searching for.

Posted by Blake Gardner on August 19, 2012 at 11:47 AM PDT #

gsf.testrunner still exists (in the ide cluster) and is in active use by everything that uses the Test Results window.

Posted by Jesse Glick on August 19, 2012 at 04:22 PM PDT #

Thanks Jesse. Let's see if people miss the feature. I will meantime investigate re-including it.

Posted by Geertjan on August 20, 2012 at 12:08 AM PDT #

Thanks but seems that it cannot be unloaded...

If I try to install netbeans says:

Networking problem in http://java.net/projects/nb-api-samples/sources/api-samples/content/versions/7.2/misc/community-ruby-plugins/org-netbeans-modules-ruby-kit.nbm

Trying with wget I receive: 502 Proxy Error

My network connection is good, I have no proxy, maybe the server is down ?

Posted by guest on August 20, 2012 at 07:13 AM PDT #

Solved,

now the plugin can be downloaded, probably a server temporary problem...

Thanks Geertjan

Posted by Tex on August 20, 2012 at 07:23 AM PDT #

Thanks a lot, worked fine for me. Even without going over the "gory details" and without much experience in using netbeans.

Posted by guest on August 20, 2012 at 12:34 PM PDT #

Hey, it's fantastic to see some progress with the netbeans ruby plugin! I see that some of the changes from here are already committed to the the Mercury repo, too.

But when I tried to build it, I got this error:

/w/projects/community-ruby/.hg/nb/harness/build.xml:174: No dependent module org.netbeans.libs.junit4

which is odd, because I have junit installed (the plugin says it supplies versions 3 and 4).

The plugins from the https://blogs.oracle.com/geertjan/resource/nb-72-community-ruby.xml repo work great, except that the debug button in netbeans does absolutely nothing. There are no errors displayed in either the netbeans output or in ~/.netbeans/7.2/var/log/messages.log. Does anyone know why this would be? I'm using Ubuntu 12.04 and Rails3, with the ruby-debug-ide 0.4.17.beta14 plugin and ruby-debug-base19x 0.11.30.pre10, and this combination works fine in netbeans 7.1.2.

Posted by rocko on August 22, 2012 at 02:57 AM PDT #

when you hit CTRL+SPACE, code completion popup is displayed, and then everything freezes.

Posted by haris on August 27, 2012 at 12:32 AM PDT #

Hi,

I'm using this plugin with NetBeans 7.2 and when code completion begins, the IDE freezes. The issue is very similar to this http://forums.netbeans.org/post-134865.html, but I'm not using j2ee. I only downloaded the PHP version of the IDE then installed the ruby plugin.

I'm using a Mac OSx 10.8.1 with 8gb.

java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)

Any ideas?

Posted by Curt on September 04, 2012 at 07:33 AM PDT #

Thanks for this. I can finally ditch NB 6.9.1!

Posted by Electrawn on September 05, 2012 at 08:38 AM PDT #

Thank you! Saved me having to switch to IntelliJ.

Posted by guest on September 08, 2012 at 11:08 AM PDT #

Thanks dude! Saved me some time :)

Posted by guest on September 17, 2012 at 12:22 AM PDT #

Thank you very much for setting up the new update center. This makes the installation straightforward.

Posted by Christophe Broult on September 22, 2012 at 02:06 AM PDT #

I have the same issue as Harris: when a completion popup is supposed to show up, there's just "Please wait..." and it freezes (NetBeans consuming roughly 10 % CPU, UI not responsive to anything).

Posted by guest on September 25, 2012 at 09:41 AM PDT #

Help! :-)

I keep getting an error! It keeps telling me:

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

The file it's looking for, in build.xml, "${binaries.cache}/943CD5C8802B2A3A64A010EFB86EC19BAC142E40-ant-contrib-1.0b3.jar" doesn't seem to exist. (binaries.cache points to /Users/carolyn/.hgexternalcache).

I'm on the latest Mountain Lion, with Netbeans 7.2 build 201207171143. Any help is appreciated! Thanks. :-)

Carolyn

Posted by Carolyn Ann on September 25, 2012 at 03:16 PM PDT #

Unfortunately building the project failed with:

/Users/…/NetBeansProjects/community-ruby/build.xml:29: The following error occurred while executing this line:
/Users/…/NetBeansProjects/community-ruby/build.xml:33: Problem: failed to create task or type for
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
BUILD FAILED (total time: 3 seconds)

Posted by guest on September 27, 2012 at 06:00 PM PDT #

Thank you, this helped me to move from NB 6.9 to NB 7.2 for my ruby development.

Posted by guest on September 28, 2012 at 02:12 AM PDT #

Thanks for this. Sadly it's not working for me.

I'm using test/unit and when I <shift-F6> to run tests that include sinatra, sinatra loads as a web server instead of the tests themselves running. Tests without sinatra run fine. All my tests run fine in 7.1.

I spotted some other problems:

- The ruby 1.9 syntax: { key: value } is highlighted as an error,
- <Alt-F6> to run all tests does nothing at all.
- If you have, say, the navigator open and it has focus, then opening a file will open into the navigator instead of into main files' area.

Btw, where is the best place to file issues? hg.netbeans.org doesn't appear to have that facility.

Marc

Posted by guest on October 01, 2012 at 06:50 AM PDT #

This works great!
I'm not seeing the problems the previous posters mention, pop-up documentation with ctrl-space works fine too, although I'm not using the integrated testing, a simple "rake test" in a command window will give you a better experience anyway. I'm using the latest Netbeans 7.2 (upgraded through the plugin centre).

Note that if you tried the 7.1 version of the plugin you need to do "rm -rf ~/Library/Application\ Support/NetBeans/7.2" and "rm -rf ~/Library/Caches/NetBeans/7.2" to remove old debris.

Geweldig bedankt Geert Jan.

Posted by Jan M on October 02, 2012 at 02:51 AM PDT #

I finally managed to build the ruby plugin for Nebeans 7.2 on Ubuntu 12.10, and the debug button now works... I sure had to jump through some hoops, though:

1. The 'dependent module junit4 is not installed' error I got before is due to the bug http://netbeans.org/bugzilla/show_bug.cgi?id=198739. The workaround is to install netbeans as root, then run it once with "sudo -i /usr/local/netbeans-7.2/bin/netbeans" to make it install junit4 in /usr/local instead of your home folder.

2. After this, when I tried to build the project, it complained that the com-jcraft-jsch, org-apache-commons-httpclient, org-apache-commons-io modules were missing. The jar files for these are all in /usr/local/netbeans-7.2/platform/modules, and so I created library wrapper projects for them as described in http://deadlock.netbeans.org/hudson/job/faqsuck/lastSuccessfulBuild/artifact/other/faqsuck/build/faq.html#DevFaqWrapperModules. I also created wrapper libraries for com-jcraft-jzlib and org-apache-commons-logging. This was enough to get it to build, even though the Project Properties / Libraries complained about incompatible specification versions for the wrapper libraries.

3. The "package as NBMs" command created 22 plugins, but not the org-jruby-jruby.nbm module, which the "Ruby Projects" module required, so I couldn't install the plugins in Netbeans. I manually copied the jruby-complete-1.6.5.1.jar file from the o.jruby.complete project module to another folder, then deleted the o.jruby.complete project and made a new wrapper project for jruby-complete-1.6.5.1.jar with codebase org.jruby.jruby. After running "package as NBMs", all 23 NBM packages were created and I was finally able to install them.

Posted by rocko on October 09, 2012 at 12:49 AM PDT #

Me puedes ayudar en el tercer punto, eso de generar el org.jruby.jruby?

Posted by guest on October 10, 2012 at 07:32 AM PDT #

@guest: para generar el archivo de jorg.jruby.jruby.nbm: el problema se encuentra en el modulo o.jruby.complete, entonces tienes que suprimirlo y creer otro:

* buscar el archivo jruby-complete-1.6.5.1.jar y ponerlo en alguna otra parte

* suprimir el modulo o.jruby.complete desde la lista de modulos (quizas tienes que suprimir tambien el directorio o.jruby.complete)

* creer un nuevo wrapper library (File > New Project > NetBeans Modules > Library Wrapper Module) y elegir jruby-complete-1.6.5.1.jar como archivo de jar, pues org.jruby.jruby como 'code base'.

Posted by rocko on October 10, 2012 at 09:11 PM PDT #

I also have the issue that at sometime everything freezes when code completion is running. I'm using Netbeans 7.2 (PHP version with this Ruby plugin) in Ubuntu 12.04 and Ruby MRI 1.9.3p286.

Posted by Guilherme on October 18, 2012 at 03:19 PM PDT #

I found where the lockup is occurring, so I can work around it now. The lockup occurs in RubyIndex.java in the search method. At some point the call to querySupport.query fails to return; this appears to only happen when kind == Kind.EXACT, so adding a test for it stops the lockup:

if (kind == kind.EXACT) return true; // add this to avoid an editor lockup
result.addAll(querySupport.query(key, name, kind, fieldsToLoad));

I'm not sure what effect this workaround has on the code completion, though. Lots of threads call this search method, but the one that is causing the lockup is in the class RubyCodeCompleter. I'll report this back to the plugin webpage.

Posted by rocko on October 19, 2012 at 08:07 PM PDT #

I found a better workaround for the lockup problem. The workaround I suggested above does stop the lockup, but breaks code navigation for exact matches on classes. I've put the details of the new workaround on the plugin page at http://plugins.netbeans.org/plugin/38549.

Posted by rocko on October 25, 2012 at 12:00 AM PDT #

Thank you for this workaround.

Posted by Vratislav on November 10, 2012 at 11:01 AM PST #

Excellent!

Thank you for the continued support.

Posted by guest on December 04, 2012 at 03:29 PM PST #

Also, you look very much like Quentin Tarantino.

Posted by guest on December 04, 2012 at 03:30 PM PST #

Hello Geertjan, do you think it is worthwhile starting a petition to ask Oracle to re-include official support for Ruby in Netbeans? Obviously there is still a great amount of interest in Ruby for Netbeans. Thanks, Martin

Posted by Martin on December 11, 2012 at 10:16 PM PST #

What the heck. I have gone ahead and created a petition: http://www.ipetitions.com/petition/re-include-ruby-support-in-netbeans/

Posted by Martin on December 11, 2012 at 11:23 PM PST #

I think it's smarter to try and create a community of developers around the Ruby plugin. That's the beauty of open source: you don't need to rely on a company to do the work for you if you can organize yourselves around it and make it happen yourself.

Posted by Geertjan on December 11, 2012 at 11:29 PM PST #

Personally, I won't vote for this petition. In the same way that ZeroTurnaround is creating the JRebel plugin for NetBeans IDE, so the Ruby community should continue (as is happening already with Tom Enebo from the Ruby community) the Ruby plugin for NetBeans IDE.

Posted by Geertjan on December 11, 2012 at 11:31 PM PST #

Thanks Geertjan for your input. Do you mean to say that the project cannot be endorsed/supported by Oracle and be community-developed at the same time? (i.e. will Oracle refuse to support it if it is community developed?)

Posted by Martin on December 12, 2012 at 12:44 AM PST #

The way most features that are not directly related to Java are supported in NetBeans IDE is via external plugins. So, one example is the JRebel plugin for NetBeans, developed by ZeroTurnaround. Another example is the JRuby plugin for NetBeans, developed by the JRuby community under the leadership of Tom Enebo. And Oracle supports those plugins by promoting those plugins, e.g., via articles on NetBeans Zone, via the NetBeans Weekly Newsletter, via Twitter, etc.

Posted by Geertjan on December 12, 2012 at 01:20 AM PST #

Thanks for the feedback, Geertjan. I am at a bit of a loss though as to why you would not want this to be sponsored by Oracle. Would it mean that Tom Enebo (who I assume is not an Oracle employee) not be allowed to continue leading the project? Or would Oracle want too much control? I would have thought that having Oracle support it would mean greater support for the community developers. Regards, Martin

Posted by Martin on December 12, 2012 at 04:27 AM PST #

The point is that Oracle only has a limited amount of resources. It can't do everything. And the best people to work on a plugin for JRuby are the people who are part of the JRuby community. I'd far rather learn and use a JRuby plugin developed by the JRuby community than one developed by Oracle. What does Oracle know about JRuby? Not much, if anything. What does the JRuby community itself know? Everything, right? So, who would be better to work on that plugin -- Oracle or the community of developers who actually use JRuby on a daily basis?

Posted by Geertjan on December 12, 2012 at 05:03 AM PST #

Bump: I have Same problem.. any solution.

--------
Hi,

I'm using this plugin with NetBeans 7.2 and when code completion begins, the IDE freezes. The issue is very similar to this http://forums.netbeans.org/post-134865.html, but I'm not using j2ee. I only downloaded the PHP version of the IDE then installed the ruby plugin.

I'm using a Mac OSx 10.8.1 with 8gb.

java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)

Any ideas?

Posted by guest on December 15, 2012 at 02:27 PM PST #

Obviously, the JRuby community knows nothing about Netbeans since the ruby plugin is currently broken for NB 7.2

Posted by Mike on December 17, 2012 at 01:42 PM PST #

@Mike: The plugin works fine for me on Mac OS X 10.8 on Netbeans 7.2

Note that if you tried the 7.1 version of the plugin you need to do "rm -rf ~/Library/Application\ Support/NetBeans/7.2" and "rm -rf ~/Library/Caches/NetBeans/7.2" to remove old debris.

Posted by Jan M on January 07, 2013 at 03:33 AM PST #

Not everyone uses that toy OS.

Posted by Mike on January 07, 2013 at 04:46 PM PST #

With 7.3 coming out soon, and Ruby plugin broken in 7.2 is it safe to say that Netbeans Ruby is dead?

Posted by guest on February 18, 2013 at 12:47 PM PST #

It's safe to say that the right place to ask about the community plugin for Ruby is the Ruby community.

Posted by Geertjan on February 18, 2013 at 09:10 PM PST #

Work nice with NetBeans 7.3

Posted by guest on February 25, 2013 at 06:34 AM PST #

I am now getting a time out again as in a previous comment:

Networking problem in http://java.net/projects/nb-api-samples/sources/api-samples/content/versions/7.2/misc/community-ruby-plugins/org-netbeans-modules-ruby-kit.nbm

Trying with wget I receive: 502 Proxy Error

My network connection is good, I have no proxy, maybe the server is down ?

My computer recently crashed and I need to get back up and running on my project ASAP

Posted by Bill Garrison on March 13, 2013 at 09:05 AM PDT #

I have been using the pre-built plug in from http://plugins.netbeans.org/download/plugin/2340 on 7.2 and it has worked fine.
However since then 7.3 is out, and Tom has fixed a lot of issues.

Are your build and tweak instructions still relevant for 7.3 with the latest fixes, or do you intend to offer an updated pre built plug in?

Posted by guest on March 20, 2013 at 02:23 AM PDT #

The title of this blog entry clearly states that it is about NetBeans IDE 7.2. So, no, it is not about NetBeans IDE 7.3 or any version other than 7.2. Once Tom is ready with his fixes, I'll work on a new blog entry for NetBeans IDE 7.3.

Posted by Geertjan on March 20, 2013 at 04:14 AM PDT #

Hi,

I tried to add RoR to Netbeans 7.2.1 and 7.3 from https://blogs.oracle.com/geertjan/resource/nb-72-community-ruby.xml.

In both cases it ended up with the message:
Networking problem in http://java.net/projects/nb-api-samples/sources/api-samples/content/versions/7.2/misc/community-ruby-plugins/org-netbeans-modules-ruby-kit.nbm

Check your proxy settings or try again later. The server may be unavailable at the moment...

I am running Linux version - Ubuntu 13.04, do not have proxy.
Can access http://java.net/projects/nb-api-samples/sources/api-samples/content/versions/7.2/misc/community-ruby-plugins/org-netbeans-modules-ruby-kit.nbm in Chromium.

Is there anything else I've missed?

Thanks.

Posted by guest on May 09, 2013 at 01:53 AM PDT #

So get it from the right place:

http://plugins.netbeans.org/plugin/38549/ruby-and-rails

Posted by Geertjan on May 09, 2013 at 01:58 AM PDT #

I downloaded the plugin from http://plugins.netbeans.org/plugin/38549/ruby-and-rails and unzipped it.
Then
Plugin -> Downloaded -> Add Plugins
selected 'All Files' as a filter, then selected all files

Install
NetBeans IDE Installer (reports in new window)
The following plugins will be installed:
...
The following plugins will also be installed because one or more of the plugins you are about to install depend on them:
JRuby 1.6.5.1 [1.6.5]

Next
Warning
Networking problem in http://java.net/projects/nb-api-samples/sources/api-samples/content/versions/7.2/misc/community-ruby-plugins/org-jruby-jruby.jar

Worth mentioning, org-jruby-jruby.jar was in the unzipped directory and was selected, but Installer did not use it

How to make IDE Installer use local org-jruby-jruby.jar ?

Thanks

Posted by guest on May 10, 2013 at 11:42 AM PDT #

Why not leave your questions and comments about the plugin in the comments section on the plugin page?

Posted by Geertjan on May 10, 2013 at 11:57 AM PDT #

@ guest on May 10, 2013

You need to select the jar, it is filtered out of the add menu by default (only .nbm files are shown).

Posted by James on November 05, 2013 at 08:43 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« May 2015
SunMonTueWedThuFriSat
     
2
3
8
9
10
19
29
30
31
      
Today