Scala
Scala Plugins for NetBeans
Features
- Full featured Scala editor
- syntax and semantic coloring
- outline navigator
- code folding
- mark occurrences
- go to declaration
- instant rename
- indentation
- formatting
- pair matching
- error annotations
- code completion
- Project management (build/run/debug project)
- Debugger
- Interactive console
- JUnit integration
- Maven integration
Get Started
Plugins for Scala are currently under development. Here is an overview of what you can currently do with Scala in NetBeans IDE, as well as instructions for getting started.
There are two ways to get started with Scala plugin for NetBeans:
- Plugins on NetBeans's 6.7
- Cutting edge plugins on NetBeans nightly build version
1. Get Started with NetBeans 6.8
http://wiki.netbeans.org/Scala68v1
2. Get Started with NetBeans 6.7
- Install the latest Scala runtime via Scala's home
- Set SCALA_HOME to the installed Scala runtime
- Add $SCALA_HOME/bin to PATH environment variable
- Get the NetBeans 6.7 from: http://www.netbeans.org/downloads/
- Get the Scala plugins binary from: http://sourceforge.net/projects/erlybird/files/nb-scala/nb-scala%206.7v1/nb-scala-6.7v1.zip/download
- Unzip Scala plugin binary to somewhere
- Open NetBeans, go to "Tools" -> "Plugins", click on "Downloaded" tab title, click on "Add Plugins..." button, choose the directory where the Scala plugins are unzipped, select all listed *.nbm files, following the instructions. Restart IDE.
- If you encountered "... Could not connect to compilation daemon.", try to run "fsc" or "scala" under a command/terminal window first.
- If this problem persists, check your /etc/hosts file to make sure the first line reads as follows
- 127.0.0.1 localhost HOSTNAME
- Where HOSTNAME is your computer name
3. Adventure with NetBeans Nightly Build
Scala modules are experimental and under active developing, other than the beta binary, you can also try cutting edge features via development version of NetBeans. Development versions are nightly built and change rapidly, please check updates frequently too via "Tool"->"Plugins"->"Reload Catalog" (update all available modules, including those not relating to Scala). Sometime, the underlying APIs changed, and things are broken, you have to re-download a new nightly build and try ...
- Get the latest nightly build NetBeans from: http://bits.netbeans.org/download/trunk/nightly/latest/
- Open NetBeans, go to "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/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz
- Then in the "Available Plugins" tab, you can find the "Scala" category (or, you can click on "Name" in "Available Plugins" tab to find them. You may need to click "Reload Catalog" to get the latest available modules), check "Scala Kit" and click "Install", following the instructions. Restart IDE.
Set $SCALA_HOME and $PATH
The plugin kit has packaged a most recent stable Scala Development Kit (2.7.3 currently), but it always better have your own Scala Development Kit installed, please follow steps:
1. Set $SCALA_HOME and $PATH
Set your $SCALA_HOME environment variable, for example: /Users/dcaoyuan/apps/scala/share/scala/ (which contains sub-directory: bin, lib etc), to tell NetBeans using which Scala library to build your project.
Add $SCALA_HOME/bin to your $PATH environment is also a necessary now, to use "fsc" instead of "scalac"
1a. Set $SCALA_HOME for MacOS X Applications
If you $SCALA_HOME environment variable is not visible for your Applications/NetBeans, see Here
2. Set scala.home property
If you've set SCALA_HOME properly, but still encounter path error, you can try to set scala.home property: append "-J-Dscala.home=/path/to/your/scala/home" (for Windows users, try to append "-J-Dscala.home=%SCALA_HOME%") to the end of "netbeans_default_options" in your netbeans.conf file, where, "/path/to/your/scala/home" is your Scala home's absolute path. 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
3. Download Scala standard source files
Download Scala standard source jar files via http://www.scala-lang.org/downloads/index.html, unpack it (do not unzip source jar files any more). Will look like
+ src + sbaz-src.jar + scala-compiler-src.jar + scala-dbc-src.jar + scala-decoder-src.jar + scala-library-src.jar
Maven + Scala plugins
The Maven plugins for NetBeans works with Scala plugins, thus, Lift web application development is supported under NetBeans now.
To get Maven plugins for NetBeans, you can:
- Get Maven plugins directly from Update Center. "Tools" -> "Plugins" -> "Available Plugins" (Input "maven" in search box to find it)
- To download and attach source packages from the maven repository, right-click on the "Libraries" node and select "Download All Library Sources". This can be done from the "Test Libraries" and "Runtime Libraries" nodes as well. Once the source packages are downloaded, you can drill down to a particular class and double-clicking it will open the corresponding source code.
Source code
All source code is available at: http://hg.netbeans.org/main/contrib, organized as:
main + contrib + libs.scala + scala.console + scala.debug + scala.debug.projects + scala.editor + scala.kit + scala.platform + scala.project + scala.stdplatform + xtc
How to build Scala plugin from source
NetBeans' scala pluings are under NetBeans' structured source tree, that is, you should have whole Netbeans main source to build it. The steps are:
# check/set ANT_OPTS, make sure it has enough memory setting, for example: # ANT_OPTS='-Xmx1024M -XX:PermSize=1024M -XX:MaxPermSize=1024M' mkdir nbsrc cd nbsrc hg clone http://hg.netbeans.org/main cd main hg clone http://hg.netbeans.org/main/contrib # make sure you are under nbsrc/main directory, then build NetBeans itself first: ant clean build # then, build all scala plugins by: cd contrib/scala.kit ant scala-clean ant scala-build ant scala-nbm # after "ant scala-nbm", all scala nbm* will be under directory: contrib/scala.kit/build
How to debug into Scala's compiler, library sources
If you have a project that want to debug into Scala's compiler, library sources, you could do when in debugging: In debugging, open debugging source windows via: "Windows" -> "Debugging" -> "Sources". Go through the listed source jars, find ".../scala-compiler.jar" and ".../scala-library.jar", check them.
Screenshots
Documentations
1. Users
- How to Set Main Class and Run
- Novice Guide: Creating and Running Scala Project
- How to install the Scala plugin for NetBeans on a Windows XP
- JUnit Integration in Scala for NetBeans
- Run/Debug Lift Web App Using Scala/Maven Plugin for NetBeans
- NetBeans IDE Reference Card
- Known Issues, please take a look before your report issue.
2. Developers
- Proposal of Scala for NetBeans
- Features and Open Tasks of Scala for NetBeans
- Implementation of Scala for NetBeans
- Review and Final Suggestions
- Upgrade Scala Runtime libs
- Build Scala plugin from hg source
Developing Blogs
Change Log
Please see Change log for latest progressing.
Community
There is a Google group for Scala for NetBeans
How To Submit Issues
Check/Submit issues under top-level Component "languages" and "scala" subcomponent in NetBeans Issuezilla
Suggestions
- I guess the module should be written in Scala, here is a File:ScalaBuild Scala.diff sketch of the build infrastructure
- Caoyuan: Done, there is a properly configured module at scala.core, which is start point to support writing in Scala
- The scala needs to be packaged as a NetBeans module, create *libs.scala* just like libs.freemarker, etc.
- Caoyuan: Done.