Eclipse中,tomcat插件方式啟動項目


某些項目要運行多個war包,所以需要開啟多個tomcat服務器,按照傳統的方式則是新建多個tomcat服務器,比較麻煩。現在采用新的啟動方式。

1.在Maven項目中的pom.xml文件中添加tomcat插件依賴:

<!-- 配置tomcat服務器插件 -->
<build>
  <plugins>
    <plugin>
      <groupId>org.apache.tomcat.maven</groupId>
      <artifactId>tomcat7-maven-plugin</artifactId>
      <configuration>
        <path>/</path>        //引入工程名
        <port>8081</port>       //配置端口名
      </configuration>
    </plugin>
  </plugins>
</build>

2.右擊項目:選擇Run as,再選擇Maven build... ,在Goals中填寫 : clean tomcat7:run          // tomcat7為插件版本

然后 點擊Run即可。

 

3.報錯解決:

a) 錯誤之一是:項目依賴的某個jar包沒有被找到;解決方式為:右擊項目,選擇Run as,再選擇Maven install ,之后可解決問題

b) 錯誤之二是:Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project **-web: Failed to clean project: Failed to delete     E:\**\target\tomcat\logs\access_log;原因是該項目同時開啟了多個tomcat插件。

解決方式:關閉所有的tomcat插件,然后重新開啟tomcat插件。關閉tomcat插件操作如下:

 

然后再開啟tomcat插件即可。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM