maven 实现tomcat的远程部署

需要更改的有三处:
1.tomcat的配置:在conf\tomcat-users.xml中加上有管理权限的用户:
<?xml version='1.0' encoding='utf-8'?>  
<tomcat-users>  
  <role rolename="manager"/>  
  <user username=" marshal" password=" password" roles="manager"/>  
</tomcat-users> 

2.在pox.xml中添加
plugin>  
    <groupId>org.codehaus.mojo</groupId>  
    <artifactId>tomcat-maven-plugin</artifactId>  
    <configuration>  
        <url> http://localhost:8080/manager</url>  
        <server> tomcat.server</server>  
        <path>/mycontext</path>  
    </configuration>  
</plugin>

3.在.m2/settings.xml文件中增加:
<settings xmlns="http://maven.apache.org/POM/4.0.0" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0  
http://maven.apache.org/xsd/settings-1.0.0.xsd">  
        <servers>  
                <server>  
                        <id> tomcat.server</id>  
                        <username> marshal</username>  
                        <password> password</password>  
                </server>  
        </servers>  
</settings> 
注意:红色的要一致,username和password要一致 ,<url>要配置上服务器的url</url>

你可能感兴趣的:(maven,tomcat,xml,配置管理)