How to use IntelliJ Idea to write and debug Groovy scripts
Posted April 24, 2013 by Giampiero Granatella
In this post we are going to see how to develop applications using IntelliJ Idea and Portofino 4. The traditional development of a web application in IntelliJ Idea 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 IntelliJ Idea, facilitates to create and edit xml pages, jsp and groovy scripts. With IntelliJ Idea we can debug Groovy scripts, browse and search classes, have syntax highlighting, auto-completion, import and automatic functions refactoring.
Project setup
Remote debug
Next step is to use IntelliJ Idea to debug our live application. To do this we need:
- configure Tomcat to start in debug mode
- configure Idea to connect to the remote server
export JPDA_ADDRESS=5005 export JPDA_TRANSPORT=dt_socket bin/catalina.sh jpda start
Conclusions
In this post we configured Idea to develop live web applications in Portofino. Developing with an IDE has many advantages, first of all the possibility to debug your live application.
You can use other Java IDEs, the configuration is similar to what done in this post.