Debug with Eclipse

 

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".

Project setup

Within 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 groovy scripts are located.

 

 

 

STEP 3. We set the Context root to "/", or the name of the context of your webapp,  and the Content directory to "/ apps / default",

 

 

Click on "Finish" and wait that  the process ends.

 

To avoid dependency problems, we create a "User Library" with all the jars in WEB-INF/lib and the lib directory of Tomcat.

To do this right click on the "Build Path> Configure build path ..." and create this library.

 

 

Now our project is ready to be managed by Eclipse.

If you have never installed the appropriate Groovy plug-in, you still have problems editing scripts.

Groovy

To install the Groovy plug-in Groovy refer to the website http://groovy.codehaus.org/Install+Groovy-Eclipse+Plugin

Click on "Help> Install New Software ..." , add the following URL and selecte packages as shown (url changes depending on the version of Eclipse).

 

 

Restart Eclipse and now our Groovy files have the syntax highlighting, and we can use the automatic import and autocompletion.

 

 

Remote Debug

Next step is to use Eclipse to debug our live application. To do 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 two 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 our case is 5005,  the value of JPDA_ADDRESS variable.

 

 

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 has many advantages, first of all the possibility to debug your live application.

You can use other Java IDEs such as NetBeans or IntelliJ,  the configuration is similar to what done in this post.

http://portofino.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

 

 

 

 

 

时间: 2024-10-30 06:35:30

Debug with Eclipse的相关文章

Debug在中Eclipse的应用

1.debug在eclipse中的显示.(可以点击右上角debug进入) Debug视图允许您在工作台上管理正在调试和运行的程序,他显示了你正在调试的程序中挂起的线程的堆栈帧,程序中的每个线程作为树的节点出现.他展示了正在运行的每个目标的进程.如果线程被挂起,它的堆栈帧以子元素的形式展示.以下是一些常用的debug按钮: Skip All Breakpoints::将所有断点设置为被跳过的,设置了Skip All Breakpoints之后,所有断点上都会有一个斜线,表示断点将被跳过,线程不会在

Android APK使用Debug签名重新打包 Eclipse更改默认Debug签名_Android

对已有的apk文件进行重新打包,前面 Android签名机制:生成keystore.签名.查看签名信息 已经介绍了.本文介绍另外两种需求. 使用默认的Debug签名打包 如果直接使用Eclipse开发新程序,默认就会被打上Debug的签名,这个是地球人皆知,但是如果你是想Repack别人并且想使用Debug签名该怎么办? 首先需要找到你本机的默认签名的,一般位于C:\Users\用户名\.android\debug.keystore下,拷出来,然后打包,打包命令: 复制代码 代码如下: jars

eclipse debug 看不到代码视图

问题描述 eclipse debug 看不到代码视图 怎么调试出来 解决方案 http://www.cnblogs.com/stonefeng/archive/2012/08/28/2660136.html 解决方案二: 为什么eclipse的debug的代码和程序的代码不一样Eclipse 调试器和 Debug 视图Eclipse 调试器和Debug 视图 解决方案三: 应该是被你给缩放了, 你找到右边的边框处会有 Shared Area ,然后还原.

eclipse里面的debug问题

问题描述 eclipse里面的debug问题 首先我在controller里面的某个方法里面设置了一个断点 然后页面上面的事件在js里面的的请求路径与controller里面的requestmapping的路径是一样的 最后在页面上面调试的时候 就是进不去设置断点的方法里面 是什么情况????? 解决方案 页面上面的F12 和eclipse里面的控制台都没有错误信息输出!!!!!!!! 解决方案二: 那就是没有关联成功啊 解决方案三: eclipse下的debug问题eclipse debug断

Android APK使用Debug签名重新打包 Eclipse更改默认Debug签名

对已有的apk文件进行重新打包,前面 Android签名机制:生成keystore.签名.查看签名信息 已经介绍了.本文介绍另外两种需求. 使用默认的Debug签名打包 如果直接使用Eclipse开发新程序,默认就会被打上Debug的签名,这个是地球人皆知,但是如果你是想Repack别人并且想使用Debug签名该怎么办? 首先需要找到你本机的默认签名的,一般位于C:\Users\用户名\.android\debug.keystore下,拷出来,然后打包,打包命令: 复制代码 代码如下: jars

使用Eclipse平台调试您的软件项目

调试是程序员无法回避的工作.调试方法有许多种,但归根结底,就是找到引发错误的代码.举例来说,在 Linux 应用程序中,分段故障被认为是最常见的错误之一.当程序尝试访问未分配给它的内存并因为分段违例而终止时,将产生这种错误. 要修正这种错误,您需要找到引发该行为的那行代码.一旦找到有问题的代码行,这对于知道引发错误的上下文及其相关的值.变量和方法也是有所帮助的.使用调试器将使查找这些信息变得相当简单. Eclipse 调试器及 Debug 视图 Eclipse 平台的特色在于内置了 Java 调

搜罗Android开发eclipse错误汇总

大家都在为项目开发成功而喜悦,但可不知成功的路上是会经常出错的,下面是我碰到的一些错误集合! [错误信息] [2011-01-19 16:39:10 - ApiDemos] WARNING: Application does not specify an API level requirement! [2011-01-19 16:39:10 - ApiDemos] Device API version is 8 (Android 2.2)原因: 不影响正常运行.在AndroidManifest.

Hadoop2.2.0 eclipse插件编译及Ecliipse配置说明(图文版)

一.引言: 最近在做一个城商行项目的POC测试it版本,涉及到编译Linux64bti的源码和开发插件使用,作为笔记分享给大家. 二.插件编译 Hadoop2x版本的Eclipse插件已经单独抽取成独立的开源项目,区别于之前版本直接集成到Hadoop1.x版本的模式,需要单独下载,下载网址:https://github.com/winghc/hadoop2x-eclipse-plugin 2.1 源码编译 hadoop2x-eclipse-plugin =====================

Eclipse的使用总结

Eclipse的使用总结 Eclipse的简介: Eclipse是一种可扩展的开放源代码的IDE.下载:http://eclipse.org/ MyEclipse是在Eclipse基础上追加的功能性插件,对插件收费:在WEB开发中提供强大的系统架构平台 Eclipse的基本使用: 编译:自动编译,在保存的那一刻帮你做好了 运行:   A. 点击虫子后面的绿色内在三角形按钮   B. 点击Run菜单下的run.也可以使用快捷键Ctrl+F11   C. 选择要运行的文件或者在要运行的文件内容中,右