Debug with Eclipse

Source: Internet
Author: User

The This post is 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 a n Application server such as Tomcat. This was certainly possible even with Portofino, but it had both drawbacks:first redeployment is slow and second this life Cycle loses the capability of Groovy scripts to being edited on live systems.

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

Why use the An IDE? Portofino can managed only through a browser and, optionally, with a text editor. But the use of a 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, 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 develope Rs ".

Project Setupwithin Eclipse, create a new Dynamic Web project  step1. Set the project name and use the war expanded under Tomcat (ROOT direcetory) as "location". We can ignore the other parameters and click on "Next".    step 2. We can remove the "src" directory that Eclipse created, and add the directory "Apps/default/groovy" where shared Groov Y scripts is located.   step 3. We set the context root to "/", or the name of the context of your webapp,  and the Content directory to "/Apps/de Fault ",   click on" Finish "and wait that  the process ends. to avoid dependency problems, we crea Te a "User Library" with all the jars in Web-inf/lib and the Lib directory of tomcat.to does this right click on the "Build path> Configure Build Path ... "and create this library.  now our project are ready to be managed by eclipse.i f you has never installed the appropriate Groovy plug-in, you still has problems editinG Scripts. Groovyto Install the Groovy plug-in groovy refer to the website http://groovy.codehaus.org/Install+Groovy-Eclipse+ Pluginclick on "help> Install New software ...", add the following URL and selecte packages as shown (URL changes Depe Nding on the version of Eclipse).   restart Eclipse and today our Groovy files has the syntax highlighting, and we can use the automatic import and Autocompletion.  remote Debug

Next step is the use of Eclipse to debug our live application. To does this we need:

    1. Configure Tomcat to start in debug mode
    2. Configure Eclipse to connect to the remote server
For these steps you can refer to http://wiki.apache.org/tomcat/FAQ/Developing. To activate debug mode, set of environment variables and starting Tomcat as shown below (the following code is for Linux or MAC)
Export jpda_address=5005 export Jpda_transport=dt_socket bin/catalina.sh JPDA start
In Eclipse click on "Run->debug configurations ...". Select a new "Remote Java Applications" and set the host and port, in We are 5005, the value of Jpda_address variabl E. And that ' s it. Put a break point in Security.groovy, log in and you can use the Eclipse Debug. Conclusions

In this post we configured Eclipse to develop live Web applications in Portofino. Developing with an IDE have many advantages, first of all the possibility to debug your live application.

You can use other Java IDEs such as NetBeans or IntelliJ, and the configuration is similar to what do in this post.http://p Ortofino.manydesigns.com/en/blog/eclipse-groovy-debug? Http://www.jetbrains.com/idea/help/run-debug-configuration-cucumber-java.html http://www.jetbrains.com/idea/ Help/run-debug-configurations.html

Debug with Eclipse

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.