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 mvn.run $ 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.run 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)
Posted at 03:10PM Jul 29, 2008 by dcaoyuan in NetBeans | Comments[2]

