1.启动tomcat,使用startup.bat
2.指定xxxx12项目名称,指定tomcat,配置tomcat用户名和密码,path如果使用/则会部署在tomcat下的root目录下,也就是根目录
<build>
<finalName>xxxxx12</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:9090/manager/text</url>
<!-- <path>/</path> -->
<server>tomcat</server>
<username>tomcat</username>
<password>123456</password>
</configuration>
</plugin>
</plugins>
</build>
3.右击项目,run as → maven build...→goals 处输入tomcat7:deploy → run 项目就部署完了
4.如果想要部署在root目录下
取消步骤2中的注释.
右击项目,run as → maven build...→goals 处输入tomcat7:redeploy → run
5.deploy和redeploy之间的区别.
deploy是不可重复的,比如webapp文件夹下默认就存在root文件夹,那么这个时候部署到root下,使用deploy就无法部署成功了.必须使用redeploy