一、maven的配置

<build>
		<finalName>fish-web</finalName>
		<!--  将项目发布到tomcat6   -->
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>tomcat-maven-plugin</artifactId>
					<version>1.1</version>
					<configuration>
						<!--<url>http://localhost:8080/manager</url> -->
						<path>/fish-web</path>
						<username>manager</username>
						<password>manager</password>
						<uriEncoding>UTF-8</uriEncoding>
					</configuration>

				</plugin>

                  <!--  将项目发布到tomcat7 2.2的版本才支持tomcat7:deploy  -->
				<plugin>
					<groupId>org.apache.tomcat.maven</groupId>
					<artifactId>tomcat7-maven-plugin</artifactId>
					<version>2.2</version>
					<configuration>
						<!--<url>http://localhost:8080/manager/text</url>-->
						<path>/fish-web</path>
						<username>manager</username>
						<password>manager</password>
						<uriEncoding>UTF-8</uriEncoding>		
					</configuration>
				</plugin>



			</plugins>

		</pluginManagement>
	</build>


二、tomcat的tomcat-users.xml的配置

<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="manager" password="manager" roles="manager-gui, manager-script, manager"/>



三、执行mvn命令

tomcat 7:mvn -Dmaven.test.skip=true  tomcat7:redeploy

tomcat 6:mvn -Dmaven.test.skip=true  tomcat:redeploy #tomcat 6的插件 也能发布项目到tomcat7版本上