標籤:maven熱部署
一:研發工具(推薦)
Eclipse:eclipse-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
在彈出的設定框中找到 Remote Java Application 下面會有自己的工程,將port設定為8787,然後apply->close:
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>[email protected]#</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>[email protected]#</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-
Maven+Tomcat+Eclipse熱部署