今天分享下用maven配置tomcat廢話不說上代碼
1.pom.xml引入tomcat
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<!--<artifactId>tomcat-maven-plugin</artifactId>-->
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>## 標題
<path>/angular-jdbc</path>
<port>8080</port>
<uriEncoding>UTF-8</uriEncoding>
<contextFile>context.xml</contextFile>
<!--<warSourceDirectory>webapp</warSourceDirectory>-->
<systemProperties>
<JAVA_OPTS>-Xmx128m</JAVA_OPTS>
</systemProperties>
</configuration>
</plugin>
2.tomcat配置
彈框後點擊左上角+號 選擇Tomcat Server 配置 Parameter ->working directory 選擇本地項目路徑
->command line 輸入本地tomcat版本:run。 ->runner-> JRE選擇jdk版本
附截圖:
到此結束 就可以跑了