Maven+Tomcat+Eclipse熱部署

來源:互聯網
上載者:User

標籤: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熱部署

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.