Posted May 08, 2013 by Giampiero Granatella

In this post we are going to see how to develop applications using NetBeans and Portofino 4. The traditional development of a web application in NetBeans requires the creation of a web project and its deployment on an application server such as Tomcat. This is certainly possible even with Portofino, but it has two drawbacks: first redeployment is slow and second this life cycle loses the capability of Groovy scripts to be edited on live systems.

In this post we propose the idea to create a project that points to the web application running under Tomcat. Therefore we can harness the power of the IDE and to maintain the capability to make changes on the live system without redeploy.

Why use an IDE? Portofino can be managed only through a browser and, optionally, with a text editor. But the use of an IDE such as NetBeans, facilitates to create and edit xml pages, jsp and groovy scripts. With NetBeans we can debug Groovy scripts, browse and search classes, have syntax highlighting, auto-completion, import and automatic functions refactoring. Compared to the previous post about Eclipse and IntelliJ Idea, NetBeans does not offer remote debugging of Groovy scripts.

Note, during the realization of this post I used NetBeans 7.3,  "All" bundle. 

Project setup

Within NetBeans, we create a new project.
STEP 1. Select "Java Web> Web Application with Existing Sources" and click "Next".
STEP 2. We set the directory "ROOT" in the expoanded war  as "Location" and "Project Folder",  set the "Project Name" and click "Next".
STEP 3. We set the Context Path to "/", ignore the Server Configuration because we are not going to to use it. Click on "Next".
STEP 4. We set the directory "ROOT / apps / default" for the Web Pages Folder and leave unchanged the other two fields.
Set the "Sources Package Folder" to include the groovy directory. 
Click on "Finish".
Finally, our project is ready to be edited with NetBeans and Groovy scripts has the colored syntax, the syntax checking and auto imports.


In this post we saw how to configure Netbeans to develop web applications in Portofino. Unlike Eclipse or IntelliJ Idea, it is not possible to use remote debugging of Groovy scripts.



comments powered by Disqus