Thursday Jan 31, 2008

Scala on NetBeans Modules on Update Center Now

=== Updated Feb 2, 2008 ==>
There is an issue in auto-generated Scala project's ant build-impl.xml file, which get the scala.home property wrongly set. I just fixed it, please wait the new Scala Project module to be available on Update Center, which version should be 1.2.1.
===

I've added Scala modules to nightly build cluster, so, you can get/update these modules via NetBeans plugins update center from today.

Since these modules are experimental, I recommend you to download a nightly build version NetBeans before get these modules, you can get the latest nightly build NetBeans from: http://bits.netbeans.org/download/trunk/nightly/latest/

To get the Scala modules, open menu: [Tools]->[Plugins], check [Setting] to ensure "Last Development Build" is in the list of Update Centers, which with Url:
http://deadlock.netbeans.org/hudson/job/javadoc-nbms/lastSuccessfulBuild/artifact/nbbuild/nbms/updates.xml.gz

Then in the [Available Plugins] tab, you can find the "Scala" category, which currently contains 3 modules: Scala Console, Scala Editing, Scala Project (you may need to click [Reload Category]). Select them and click [Install]

Notes:

  • Don't forget to set your SCALA_HOME environment first, and append "-J-Dscala.home=scalahomepath" (for Windows users, try to append "-J-Dscala.home=%SCALA_HOME%") to the end of "netbeans_default_options" in your netbeans.conf file, where, "scalahomepath" is your Scala home's absolute path. For example: /Users/dcaoyuan/apps/scala/share/scala/ (which contains sub-directory: bin, lib etc). netbeans.conf is located at "pathToNetBeansInstallationDirectory/etc", in Mac OSX, it could be:
    /Applications/NetBeans/NetBeans\ 6.0.app/Contents/Resources/NetBeans/etc, or ~/SomePath/netbeans/etc
  • The Scala Project supporting has been rewritten, so if you have Scala projects created by previous Scala plugin, you should recreate new Scala project, and copy source files to this new created project's src directory.
  • Debugger module is not released yet.

Comments:

Thanks for all your work. I am new to Scala, but your posts made all this very interesting. I just downloaded the latest Netbeans build and the latest Scala version. Looking forward to playing with the language and your plugin.

Posted by Markus Jais (codekite) on January 31, 2008 at 08:29 PM PST #

How come it is already Friday in Canada?
Anyway, I finally will be downloading NB6. Thanks!

Posted by Javier Diaz on January 31, 2008 at 08:40 PM PST #

Great work. Keep it up.

Posted by SwitchBL8 on January 31, 2008 at 10:47 PM PST #

This blog is hosted in China freely by my friend, and the timezone is set to China at the
beginning, so I just let it be. It's already Friday in China :-)

I just adjusted the timezone to Canada Pacific

Posted by 219.236.88.130 on February 01, 2008 at 04:27 AM PST #

Can't get this to work in NB6.1M1. Everything goes well until I try to create a Scala project. I get the following (can' t post the whole stack, 1000 limit):


java.lang.NoSuchMethodError: org.netbeans.spi.project.support.ant.ProjectGenerator.createProject(Lorg/openide/filesystems/FileObject;Ljava/lang/String;Ljava/lang/String;)Lorg/netbeans/spi/project/support/ant/AntProjectHelper;
at org.netbeans.modules.scala.project.J2SEProjectGenerator.createProject(J2SEProjectGenerator.java:216)
at org.netbeans.modules.scala.project.J2SEProjectGenerator.access$000(J2SEProjectGenerator.java:78)
at org.netbeans.modules.scala.project.J2SEProjectGenerator$1.run(J2SEProjectGenerator.java:99)

Posted by Curtis Stanford on February 01, 2008 at 06:20 PM PST #

Hi Curtis,

This doesn't happen on NetBeans nightly build. If I have time, I'll try to take a look at M1.

BTW, the current NetBeans nightly build is not stable yet, there are some
Exceptions throwing out when do Java editing, but it seems not
affecting Scala editing. Hope this issue will go on soon.

Posted by Caoyuan on February 02, 2008 at 07:18 AM PST #

Cool, thanks. Look forward to trying it.

Posted by Curtis Stanford on February 02, 2008 at 06:35 PM PST #

I installed the module in the current Netbeans snapshot (OSX 10.5), but whenever I try to run the project, I get:

Could not load definitions from resource scala/tools/ant/antlib.xml. It could not be found.

I cannot find this antlib.xml file anywhere in my scala distribution.

Help!

Posted by Ian Clarke on February 03, 2008 at 05:12 PM PST #

Please disregard my last comment, I upgraded to the latest plugin versions and it seems to work now.

Posted by Ian Clarke on February 03, 2008 at 05:16 PM PST #

where to report issues?
IMO, this one is your - http://www.netbeans.org/issues/show_bug.cgi?id=126596

Posted by Lukas on February 04, 2008 at 12:53 PM PST #

Hi Lukas,

You can report issues under "languages"->"code" subcomponent

Posted by Caoyuan on February 04, 2008 at 03:15 PM PST #

Great improvements, but unfortunately I get a very annoying error every time I type a '.', because of the completion mechanism:

java.lang.NullPointerException
at org.netbeans.modules.scala.editing.Scala.completionItems(Scala.java:180)
Caused: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor234.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.netbeans.modules.languages.Feature$Method.evaluate(Feature.java:473)
at org.netbeans.modules.languages.Feature$Method.evaluate(Feature.java:424)
at ....

Btw. Can you please change scalac to fsc in the ant script to speed up compilation as I have to edit the build-impl.xml again as soon as change a project properties.

Posted by Michael Nischt on February 04, 2008 at 04:35 PM PST #

Nichael,

Which version are you using? I do not encounter the issue when press "."

To replace scalac with fsc, I have to make sure SCALA_HOME working on all OSes, Mac, Windows, Linux etc. So please wait for some time. For a temporary solution, you may try to link scalac to fsc?

Posted by Caoyuan on February 05, 2008 at 03:56 AM PST #

Thanks for the update, Editor Module Update 1.0.4 -> 1.0.5 fixes the problem :-)

Posted by Michael Nischt on February 05, 2008 at 08:05 AM PST #

I'm getting this stack trace trying to start a new Scala project with this NetBeans:

netbeans-trunk-nightly-200802120006-javaee-macosx.dmg

java.lang.NoClassDefFoundError: org/netbeans/modules/j2ee/persistence/spi/PersistenceLocationProvider
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at org.netbeans.JarClassLoader.doLoadClass(JarClassLoader.java:242)
at org.netbeans.ProxyClassLoader.selfLoadClass(ProxyClassLoader.java:253)
at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:227)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at org.netbeans.modules.scala.project.J2SEProject.createLookup(J2SEProject.java:252)
at org.netbeans.modules.scala.project.J2SEProject.<init>(J2SEProject.java:168)
at org.netbeans.modules.scala.project.J2SEProjectType.createProject(J2SEProjectType.java:69)
...

Posted by Blair Zajac on February 14, 2008 at 05:17 PM PST #

Blair,

You may need the latest nightly build again, I just tested it on NetBeans IDE Dev 200802150006.

Sometimes, to fix a bug, I have to modify code that not limited to scala only modules, which may not be updated via Update Center, and you have to download a latest nightly build.

Posted by Caoyuan on February 15, 2008 at 05:07 AM PST #

Post a Comment:
Comments are closed for this entry.