Posts for the month of July 2008

Run/Debug Lift Web App Using Scala/Maven Plugin for NetBeans

I'm a newbie to Maven, so I encountered some issues when run/debug Lift apps. The following are tips that I got, it may not be perfect, but at least work.

1. When pom.xml is changed, and classes not found errors happen on editor, you can close and reopen the project

This is a known issue, that I didn't refresh compiling context when pom.xml changed, thus the classpath dependency may be not refreshed at once, I'll fix this issue in the near future.

2. Run project by external Maven instead of embedded Maven of NetBeans plugin

I encountered java.lang.NoClassDefFoundError org/codehaus/plexus/util/DirectoryScanner when use embedded NetBeans Maven plugin (3.1.3) when invoke "Run" project, but fortunately, you can custom the binding actions in NetBeans Maven. The steps are:

  • Right click project node, choose "Properties"
  • Click on "Actions" in left-pane, choose "Use external Maven for build execution", and "set external Maven home"
  • Choose "Run project" in right-pane, input "jetty:run"
  • Choose "Debug project" in right-pane, input "jetty:run"

3. How to debug project

I'm a bit stupid here, since I don't like to change MAVEN_OPTS frequently. So I choose to do:

$ cd $MAVEN_HOME$/bin
$ cp mvn
$ cp mvnDebug mvn

Then I invoke "Debug" action from NetBeans toolbar, and get NetBeans' output window saying:

WARNING: You are running Maven builds externally, some UI functionality will not be available.
Executing:/Users/dcaoyuan/apps/apache-maven-2.0.9/bin/mvn jetty:run
Preparing to Execute Maven in Debug Mode
Listening for transport dt_socket at address: 8000

Open menu "Debug" -> "Attach Debugger...", in the popped window, for "Port:", input "8000". Everything goes smoothly then. You add/remove breakpoints just as you are doing for a regular Scala project.

Of course, if you want to turn back to "Run" from "Debug", you have to "cp mvn" back.

Anybody can give me hints on how to get this setting simple? in NetBeans Maven plugin.

Here's a snapshot: (click to enlarge it)


Scala, NetBeans, Maven, and yes, Lift now

Per recent changes, Scala for NetBeans can live with Maven for NetBeans, and yes,  Lift web framework.

The Maven for NetBeans has done an excellent work for Maven's project integration, with proper classpath supporting and indexing. So the Scala editor is well aware of auto-completion, types etc.

Here's a snapshot: (click to enlarge it)


To get above features, you have to download the latest NetBeans daily build, then install Scala's plugins and Maven plugins.

For Scala plugins, see; For Maven plugins, see

Implementation of Scala for NetBeans based on GSF

The Scala for NetBeans is under pre-beta stage, other than bug-fixes, I'm preparing some documentations for it too. If you are interested in how to write language supporting under GSF's framework, you can take a look at this working documentation.

Implementation of Scala for NetBeans

And also:

Proposal of Scala for NetBeans

Progressing of Scala for NetBeans

Scala for NetBeans Screenshot#12: JUnit integration

There is a Scala JUnit Test template in Scala for NetBeans now, you can create Scala JUnit testing and run testing, see testing result.

Here is an example test file:

 * DogTest.scala
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.

package scalajunit

import org.junit.After
import org.junit.Before
import org.junit.Test
import org.junit.Assert._

class DogTest {

    def setUp() = {

    def tearDown() = {

    def testHello() = {
        val dog = new Dog()"Mr. Foo")

    def testAdding() = {
        assertEquals(4, 2 + 3)

To get JUnit working, upgrade to Scala Project Module version 1.2.14, and re-create a new project for exist old project (if there has been one). Under the "Test Packages", create your testing packages, right click on package node, select create "Scala JUnit Test".

To run tests, right-click on project node, choose "Test".

And also, the beta-release is feature frozen, I'll concentrate on bug-fixes in next 1-2 weeks, and get it ready for public release as beta.


Employ Scala's Native Compiler in Scala for NetBeans

>>> Updated 3 hours later
Fixed document displaying and go to declaration for Java element.
Please update to Scala Editing version 1.1.4

Well, it's a fairly long time after I latest blog about Scala for NetBeans. I was busy on several things, and can only work on this project on my spare time.

The good news is that I've integrated Scala's native compiler into this handy plugin, it means that the error messages shown in the editor will be the same as building now. And, the auto-completion feature is totally rewritten too, which also use AST tree that was created by Scala's native compiler to get all the candidate content assistant items.

The only problem is that the Java's document comments and offset to be go to when press CTRL + Click does not work properly yet, I have several way to resolve it, but I'm looking for a best way.

Another exciting news is that I've been invited to join NetBeans Dream Team, and of course, I accepted this invitation.

I'm planning to get Scala plugin for NetBeans to beta release in August, which will be compatible with NetBeans 6.5