如何在IntelliJ中使用Jetty Runner配置调试Tapestry Web应用
解决IntelliJ下Tapestry5项目搭配Jetty Runner调试断点不触发问题
问题描述
使用IntelliJ作为Tapestry5应用的开发IDE,服务端采用IntelliJ的Jetty Runner插件,以调试模式运行项目时,已正确设置的断点始终无法命中。
排查&解决步骤
- 第一步:确认编译配置开启了调试符号生成
以Maven项目为例,检查pom.xml中maven-compiler-plugin配置,确保没有关闭debug选项,参考配置如下:
Gradle项目则在build.gradle中添加如下配置:<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> <configuration> <source>1.8</source> <target>1.8</target> <debug>true</debug> <debuglevel>lines,vars,source</debuglevel> </configuration> </plugin>tasks.withType(JavaCompile) { options.debug = true options.debugOptions.debugLevel = "source,lines,vars" } - 第二步:检查Jetty Runner运行配置
打开对应Jetty Runner的运行配置页,确认启动模式选择为调试,同时检查配置的类路径是否和你打了断点的模块一致,避免加载到其他路径下的同名无调试信息的类。 - 第三步:关闭Tapestry生产模式
Tapestry的生产模式会做字节码优化,极易导致断点和实际运行的字节码不匹配,打开项目的web.xml,确认生产模式参数已关闭:<context-param> <param-name>tapestry.production-mode</param-name> <param-value>false</param-value> </context-param> - 第四步:清理缓存重新构建
执行IntelliJ顶部菜单的Build > Clean Project,再执行Rebuild Project,清除历史编译的旧文件。如果还是不生效,执行File > Invalidate Caches...清空IDE缓存后重启,再启动调试即可。
内容的提问来源于stack exchange,提问作者Ahmed Makni
相关产品推荐
相关产品推荐

