首页 > 其他分享 >Debug with Eclipse

Debug with Eclipse

时间:2023-01-04 20:31:45浏览次数:66  
标签:Groovy groovy use Tomcat Eclipse debug Debug

 

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​

 

 

 

 

 



标签:Groovy,groovy,use,Tomcat,Eclipse,debug,Debug
From: https://blog.51cto.com/u_15147537/5989234

相关文章

  • 【前端调试】- 更好的调试方式 VSCode Debugger
    用VSCode打开项目目录,创建.vscode/launch.json文件或者点击调试窗口:点击添加配置可以生成默认的配置runtimeExecutable:可以指定对应的浏览器,路径是你浏览......
  • Intellij IDEA 在DEBUG模式下如何不执行后续代码直接停止程序
    IntellijIDEA在DEBUG模式下如何不执行后续代码直接停止程序第一步:打断点第二步:找出控制台idea可以使用快捷键:两下alt,点击左下角的debug第三步:出现当前页面然后,在......
  • linux内核 DebugFS
    一、简介DebugFS,顾名思义,是一种用于内核调试的虚拟文件系统,内核开发者通过debugfs和用户空间交换数据。类似的虚拟文件系统还有procfs和sysfs等,这几种虚拟文件系统都并不实......
  • Debugging Freeswitch
    Contents[hide]1Introduction2Troubleshooting2.1HandyTroubleshootingLinks2.2UUIDStampateachDEBUGline2.3ChasingdownXMLerrors2.4Recompilingw......
  • vscode设置python代码debug(调试) 与带参数调试
    VScode官方调试说明:https://code.visualstudio.com/docs/python/debugging#_set-configuration-options 一、带参数的Debug调试,launch.json文件创建来源1.新建p......
  • 在pycharm里debug以学习huggingface/transformers
    把https://github.com/huggingface/transformers整个zip下载下来把src/transformers文件夹复制出来,放pycharm里,成这样:根据https://github.com/huggingface/transform......
  • 小心Debug与Release报错行号不一样
    Debug调试版和Release发行版,它们有各用的特点和用途。但要注意抛出异常时的行号可能不相同。以下面一段代码为例:usingSystem;usingSystem.Windows.Forms;namespace......
  • 【Qt】问题解决:Unable to create a debugging engine.
    ......
  • eclipse下简单配置struts2.5.8
    1.下载structs2.5.8jar包。首先去官方下载structs2.5.8的jar包。下载地址:http://struts.apache.org/download.cgi#struts258点击下载完成之后,将该压缩包进行解压。2.在eclip......
  • day06 Debug&基础练习
    1.Debug模式1.1什么是Debug模式是供程序员使用的程序调试工具,它可以用于查看程序的执行流程,也可以用于追踪程序执行过程来调试程序。1.2Debug介绍与操作流程如何加......