maven拓展——eclipse中運行maven項目
阿新 • • 發佈:2017-06-27
pan str tomcat7 web 右鍵 alt bsp image strong
首先,在pom.xml中配置插件:
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
< configuration>
<port>8080</port>
<path>/ssm-crud</path>
<uriEncoding>UTF-8</uriEncoding>
<finalName>ssm-crud</finalName>
<server>tomcat7</server >
</configuration>
</plugin>
</plugins>
</build>
在eclipse中配置maven插件(見另外一篇博客):
選擇pom.xml文件——>右鍵——>選擇 Run As——> Maven build ...
幾個常用的maven命令:
命令 | 描述 |
tomcat:deploy | 部署一個web war包 |
tomcat:reload | 重新加載web war包 |
tomcat:start |
啟動tomcat |
tomcat:stop |
停止tomcat |
tomcat:undeploy |
停止一個war包 |
tomcat:run | 啟動嵌入式tomcat ,並運行當前項目 |
在這裏要註意一下,該插件命名方式有些不同,比如啟動tomcat ,對應的目標命令是: tomcat7:run ,同樣,其它命令也是這樣,需要更改為:tomcat7:<插件執行點>
//maven在網絡不穩定時會產生一些奇怪的問題,解決方案是刪掉重新下載!
maven拓展——eclipse中運行maven項目