1. 程式人生 > >使用maven的tomcat:run 部署tomcat

使用maven的tomcat:run 部署tomcat

tor fig ble info posit 部署 lin jsptag erl

項目結構:技術分享圖片
Maven工程沒有Tomcat環境也能運行web工程:(pom.xml中) 1, 配置tomcat-maven插件
<build>
<finalName>babasport</finalName> <!-- 添加tomcat插件,eclipse不用再配置tomcat運行環境. Run As-Maven build...-clean package 啟動web頁面 --> <plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<!-- 本地jdk版本 -->
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat8-maven-plugin</artifactId>
<version>3.0-r1756463</version>
<!-- 在package階段啟動web容器 -->
<executions>
<execution>
<!-- 打包階段 -->
<phase>package</phase>
<!-- 運行目標 -->
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build> 2, 配置jsp ,servlet 等依賴
<!-- 配置jsp依賴 -->
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp/jsp-api -->
<dependency>
    <groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
<dependency>
    <groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jsptags/pager-taglib -->
<dependency>
    <groupId>jsptags</groupId>
<artifactId>pager-taglib</artifactId>
<version>2.0</version>
<!--  -->
<scope>provided</scope>
</dependency>
1
<!-- 配置jsp依賴 -->
2
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp/jsp-api -->
3
<dependency>
4
    <groupId>javax.servlet.jsp</groupId>
5
<artifactId>jsp-api</artifactId>
6
<version>2.2</version>
7
<scope>provided</scope>
8
</dependency>
9
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
10
<dependency>
11
    <groupId>javax.servlet</groupId>
12
<artifactId>jstl</artifactId>
13
<version>1.2</version>
14
</dependency>
15
<!-- https://mvnrepository.com/artifact/jsptags/pager-taglib -->
16
<dependency>
17
    <groupId>jsptags</groupId>
18
<artifactId>pager-taglib</artifactId>
19
<version>2.0</version>
20
<!--  -->
21
<scope>provided</scope>
22
</dependency>

http://blog.csdn.net/enson16855/article/details/46802983

使用maven的tomcat:run 部署tomcat