How to use Eclipse to write and debug Groovy scripts
Posted March 27, 2013 by Giampiero Granatella
In this post we are going to see how to develop applications using Eclipse and Portofino 4. The traditional development of a web application in Eclipse 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 Eclipse, facilitates to create and edit xml pages, jsp and groovy scripts. With Eclipse we can debug Groovy scripts, browse and search classes, have syntax highlighting, auto-completion, import and automatic functions refactoring.
Note. During realization of this post I used the latest version of Eclipse Juno and the bundle "Eclipse IDE for Java EE Developers".
Next step is to use Eclipse to debug our live application. To do this we need:
configure Tomcat to start in debug mode
configure Eclipse to connect to the remote server
export JPDA_ADDRESS=5005 export JPDA_TRANSPORT=dt_socket bin/catalina.sh jpda start
In this post we configured Eclipse to develop live web applications in Portofino. Developing with an IDE has many advantages, first of all the possibility to debug your live application.