1.tomcat-users.xml
ps:eclipse 中Servers 中的文件
<role rolename="manager-gui" />
<role rolename="manager-script" />
<user username="admin" password="admin"
roles="manager-gui, manager-script" />
2.项目中的pom.xml
复制代码
<profiles>
<profile>
<id>dev</id>
<properties>
<env>dev</env>
<deploy.url>http://localhost:8080/manager/</deploy.url>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>test</id>
<properties>
<env>test</env>
</properties>
</profile>
<profile>
<id>product</id>
<properties>
<env>product</env>
</properties>
</profile>
</profiles>
#plugins
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>tomcat</server>
<path>/</path>
<username>admin</username>
<password>admin</password>
</configuration>
<version>1.1</version>
</plugin>
复制代码
3.启动tomcat
4.命令行模式下
cd ${工程根目录}
mvn tomcat:redeploy
ps:eclipse 中Servers 中的文件
<role rolename="manager-gui" />
<role rolename="manager-script" />
<user username="admin" password="admin"
roles="manager-gui, manager-script" />
2.项目中的pom.xml
复制代码
<profiles>
<profile>
<id>dev</id>
<properties>
<env>dev</env>
<deploy.url>http://localhost:8080/manager/</deploy.url>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>test</id>
<properties>
<env>test</env>
</properties>
</profile>
<profile>
<id>product</id>
<properties>
<env>product</env>
</properties>
</profile>
</profiles>
#plugins
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>tomcat</server>
<path>/</path>
<username>admin</username>
<password>admin</password>
</configuration>
<version>1.1</version>
</plugin>
复制代码
3.启动tomcat
4.命令行模式下
cd ${工程根目录}
mvn tomcat:redeploy