Maven 管理的WEB項目發布到Tomcat上

來源:互聯網
上載者:User

標籤:cat   ges   cti   group   web項目   技術分享   artifact   pom.xml檔案   配置   

1、需要Tomcat伺服器

   這裡可以使用已下載好的Tomcat也可以使用Maven來自動引入Tomcat外掛程式。

  通過Maven引入Tomcat伺服器

  在項目的pom.xml檔案中project 標籤中添加以下內容。

<build>    <plugins>        <plugin>            <groupId>org.apache.tomcat.maven</groupId>            <artifactId>tomcat7-maven-plugin</artifactId>            <version>2.2</version>            <configuration>                <!--設定連接埠號碼,之後在瀏覽器中訪問可直接輸入localhost:8090-->                <port>8090</port>                <!--設定了預設配置,也可設定成 /xxx -->                <path>/</path>            </configuration>        </plugin>    </plugins></build>

 

注意:build標籤在pom.xml中只能存在一個。

 

2.啟動容器

  右鍵項目--> Run As --> Run Configcations... 

  

  匯入源碼:

  

  最後run 走起來....

 

3.出現以下標識,表示伺服器已正常啟動

 

 

Maven 管理的WEB項目發布到Tomcat上

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.