整合maven,jetty,jrebel进行debug调试
整合maven,jetty,jrebel进行调试
maven配置
这个网上有很多,验证mvn是否配置正确:
Jrebel配置
- 解压至目录,不建议目录名有空格 ,破解包下载
- 参考:
- 由于都在eclipse中运行就不配置系统环境变量了
jetty配置
-
maven插件,pom.xml中插入
<plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>9.1.3.v20140225</version> <configuration> <useTestScope>true</useTestScope> <scanIntervalSeconds>0</scanIntervalSeconds> <useTestClasspath>true</useTestClasspath> <webApp> <!-- 从jetty的jar中拷贝出webdefault.xml 修改其中的参数 ,可以修改html,js --> <defaultsDescriptor>src/test/resources/jetty.xml</defaultsDescriptor> <contextPath>/${project.artifactId}</contextPath> <descriptor>${project.build.directory}/test-classes/web.xml</descriptor> </webApp> <testClassesDirectory>${project.build.testOutputDirectory}</testClassesDirectory> <stopKey>foo</stopKey> <stopPort>9999</stopPort> </configuration> </plugin>
-
run configurations
-noverify -javaagent:D:/software/jrebel/jrebel.jar -Xbootclasspath/p:jrebel-bootstrap.jar;jrebel.jar -Drebel.generate.show=true -Drebel.spring_plugin=true -Drebel.aspectj_plugin=true -Drebel.cxf_plugin=true -Drebel.logback_plugin=true -Drebel.mybatis_plugin=true -Xdebug -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
开始调试
-
点击上图中的
run
按钮2014-03-17 20:28:55 JRebel: 2014-03-17 20:28:55 JRebel: ############################################################# 2014-03-17 20:28:55 JRebel: 2014-03-17 20:28:55 JRebel: JRebel 5.4.2 (201311271505) 2014-03-17 20:28:55 JRebel: (c) Copyright ZeroTurnaround OU, Estonia, Tartu. 2014-03-17 20:28:55 JRebel: 2014-03-17 20:28:55 JRebel: Over the last 30 days JRebel prevented 2014-03-17 20:28:55 JRebel: at least 2 redeploys/restarts saving you about 0.1 hours. 2014-03-17 20:28:55 JRebel: 2014-03-17 20:28:55 JRebel: Over the last 257 days JRebel prevented 2014-03-17 20:28:55 JRebel: at least 97 redeploys/restarts saving you about 3.9 hours. 2014-03-17 20:28:55 JRebel: 2014-03-17 20:28:55 JRebel: This product is licensed to www.sdandroid.com 2014-03-17 20:28:55 JRebel: for unlimited number of developer seats on site. 2014-03-17 20:28:55 JRebel: ####### Cracked by sdandroid (blog@sdandroid.com) ###### 2014-03-17 20:28:55 JRebel: 2014-03-17 20:28:55 JRebel: The following plugins are disabled at the moment: 2014-03-17 20:28:55 JRebel: * Axis2 plugin (set -Drebel.axis2_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * Camel plugin (set -Drebel.camel_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * Click plugin (set -Drebel.click_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * Deltaspike plugin (set -Drebel.deltaspike_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * Eclipse RCP Plugin (set -Drebel.eclipse_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * JBoss7 EJB Plugin (set -Drebel.jboss7_ejb_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * JRuby Plugin (set -Drebel.jruby_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * Jersey plugin (set -Drebel.jersey_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * Log4j2 plugin (set -Drebel.log4j2_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * Mustache Plugin (set -Drebel.mustache_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * RESTlet plugin (set -Drebel.restlet_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * Seam-Wicket plugin (set -Drebel.seam_wicket_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * Spring Data Plugin (set -Drebel.spring_data_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * Thymeleaf Plugin (set -Drebel.thymeleaf_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * VRaptor plugin (set -Drebel.vraptor_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * Vaadin CDI utils plugin (set -Drebel.vaadin_cdiutils_plugin=true to enable) 2014-03-17 20:28:55 JRebel: * WebObjects plugin (set -Drebel.webobjects_plugin=true to enable) 2014-03-17 20:28:55 JRebel: 2014-03-17 20:28:55 JRebel: ############################################################# 2014-03-17 20:28:55 JRebel: 2014-03-17 20:28:55 JRebel: 2014-03-17 20:28:55 JRebel: A newer version '5.5.1' is available for download 2014-03-17 20:28:55 JRebel: from http://zeroturnaround.com/software/jrebel/download/ 2014-03-17 20:28:55 JRebel: Listening for transport dt_socket at address: 8787 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
当控制台开始打出如上的日志,说明你的项目正以jrebel的方式启动,并开启的debug端口为8787(如倒数第二行)
此时的项目如同没开debug一样,不会进入断点
2.添加远程调试
单击debug
按钮后,就可以自动进入断点了
作者:九州浪子
出处:http://www.cnblogs.com/juforg/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。