eclipse maven tomcat7 热部署

时间:2021-04-11 13:37:53

1.pom.xml

<plugins>
			<plugin>
				<groupId>org.apache.tomcat.maven</groupId>
				<artifactId>tomcat7-maven-plugin</artifactId>
				<version>2.1</version>
				<configuration>
					<!-- 注意此处的url -->
					<url>http://localhost:8080/manager/text</url>
					<server>tomcat7</server> <!-- 此处的名字必须和setting.xml中配置的ID一致 -->
					<username>root</username>
					<password>pasken</password>
					<path>/weixinweb</path> <!-- 此处的名字是项目发布的工程名 -->
				</configuration>
			</plugin>
		</plugins>

2.修改tomcat7的配置文件tomcat_users.xml
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="root" password="pasken" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/>

3.手动启动tomcat  /bin/startup.bat

4.启动项目

然后在eclise中执行 run as ->run configer-maven.new 配置 clean package tomcat7:deploy