Maven+Tomcat+Eclipse热部署

一:研发工具(推荐)

Eclipseeclipse-jee-kepler-SR2-win32-x86_64.zip(自带maven)

Tomcat: apache-tomcat-7.0.53

Mysql: 5.0

eclipse中引入工程(过程可能有点慢,因为需要下载工程需要的jar文件。Jar文件的下载目录为C:\Users\Administrator\.m2)

二:eclipse远程debug调试

1, 编辑tomcat\bin\catalina.bat,在

rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=�%"

前添加以下代码以绑定一个端口8787:

if ""%1"" == ""stop"" goto skip_config

SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787

:skip_config

address指的是将启动8787端口进行绑定.

2, 在eclipse中进行配置:

 右键工程->Debug as->Debug Configurations

tomcat如何以debug模式启动

在弹出的设置框中找到 Remote Java Application 下面会有自己的工程,将port设置为8787,然后apply->close:

tomcat如何以debug模式启动

OK,设置完毕。要进行debug首先要运行start.bat启动tomcat,但是这样只是一般的启动,还未进入debug模式。要想debug,就要在工程上右键->Debug as->Debug Configurations->Remote Java Application->passing(自己的工程名)->debug。之后就可以打断点debug了

3:setting.xml拷贝到C:\Users\Administrator\.m2目录下面

<servers>   
   <server>  
       <id>tomcat</id>  
       <username>admin</username>  
       <password>pass!@#</password>  
</server>
</servers>  

三:tomcat: redeploy热部署

编辑工程的pom.xml,添加下面的内容

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<server>tomcat</server>
<username>admin</username>
<password>pass!@#</password>
<url>http://127.0.0.1:8080/manager/text</url>
<path>/bright</path>
</configuration>
</plugin>

(1)启动tomcat的catalina.bat

(2)右击工程或者pom.xml,然后Run as-Maven Build-





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

十五楼亮哥

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值