X

Geertjan's Blog

  • August 19, 2012

Ruby in NetBeans IDE 7.2

Geertjan Wielenga
Product Manager

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  //cdn.app.compendium.com/uploads/user/e7c690e8-6ff9-102a-ac6d-e4aebca50425/f4a5b21d-66fa-4885-92bf-c4e81c06d916/File/70eaf0a7b4e9ae083eb7a7f669c006e7/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!

Join the discussion

Comments ( 51 )
  • Blake Gardner Sunday, August 19, 2012

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


  • Jesse Glick Sunday, August 19, 2012

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


  • Geertjan Monday, August 20, 2012

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


  • guest Monday, August 20, 2012

    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 ?


  • Tex Monday, August 20, 2012

    Solved,

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

    Thanks Geertjan


  • guest Monday, August 20, 2012

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


  • rocko Wednesday, August 22, 2012

    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.


  • haris Monday, August 27, 2012

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


  • Curt Tuesday, September 4, 2012

    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?


  • Electrawn Wednesday, September 5, 2012

    Thanks for this. I can finally ditch NB 6.9.1!


  • guest Saturday, September 8, 2012

    Thank you! Saved me having to switch to IntelliJ.


  • guest Monday, September 17, 2012

    Thanks dude! Saved me some time :)


  • Christophe Broult Saturday, September 22, 2012

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


  • guest Tuesday, September 25, 2012

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


  • Carolyn Ann Tuesday, September 25, 2012

    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


  • guest Friday, September 28, 2012

    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)


  • guest Friday, September 28, 2012

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


  • guest Monday, October 1, 2012

    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


  • Jan M Tuesday, October 2, 2012

    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.


  • rocko Tuesday, October 9, 2012

    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.


  • guest Wednesday, October 10, 2012

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


  • rocko Thursday, October 11, 2012

    @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'.


  • Guilherme Thursday, October 18, 2012

    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.


  • rocko Saturday, October 20, 2012

    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.


  • rocko Thursday, October 25, 2012

    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.


  • Vratislav Saturday, November 10, 2012

    Thank you for this workaround.


  • guest Tuesday, December 4, 2012

    Excellent!

    Thank you for the continued support.


  • guest Tuesday, December 4, 2012

    Also, you look very much like Quentin Tarantino.


  • Martin Wednesday, December 12, 2012

    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


  • Martin Wednesday, December 12, 2012

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


  • Geertjan Wednesday, December 12, 2012

    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.


  • Geertjan Wednesday, December 12, 2012

    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.


  • Martin Wednesday, December 12, 2012

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


  • Geertjan Wednesday, December 12, 2012

    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.


  • Martin Wednesday, December 12, 2012

    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


  • Geertjan Wednesday, December 12, 2012

    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?


  • guest Saturday, December 15, 2012

    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?


  • Mike Monday, December 17, 2012

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


  • Jan M Monday, January 7, 2013

    @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.


  • Mike Tuesday, January 8, 2013

    Not everyone uses that toy OS.


  • guest Monday, February 18, 2013

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


  • Geertjan Tuesday, February 19, 2013

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


  • guest Monday, February 25, 2013

    Work nice with NetBeans 7.3


  • Bill Garrison Wednesday, March 13, 2013

    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


  • guest Wednesday, March 20, 2013

    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?


  • Geertjan Wednesday, March 20, 2013

    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.


  • guest Thursday, May 9, 2013

    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.


  • Geertjan Thursday, May 9, 2013
  • guest Friday, May 10, 2013

    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


  • Geertjan Friday, May 10, 2013

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


  • James Tuesday, November 5, 2013

    @ 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).


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.