【maven】进行项目的热部署

一  修改tomcat-user.xml配置文件
-rw-------. 1 root root   2294 Jan 20 05:37 tomcat-users.xml
-rw-------. 1 root root 168893 Sep 29 05:27 web.xml
[root@bogon conf]# pwd
/usr/local/tomcat/conf

修改tomcat-user.xml

 

<tomcat-users>
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary. It is
  strongly recommended that you do NOT use one of the users in the commented out
  section below since they are intended for use with the examples web
  application.
-->
<!--
  NOTE:  The sample user and role entries below are intended for use with the
  examples web application. They are wrapped in a comment and thus are ignored
  when reading this file. If you wish to configure these users for use with the
  examples web application, do not forget to remove the <!.. ..> that surrounds
  them. You will also need to set the passwords to something appropriate.
-->
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
  <user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
  <user username="role1" password="<must-be-changed>" roles="role1"/>
-->
<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="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/> 
</tomcat-users>

配置tomcat-users 如上图说是 设置用户名密码

 

二 修改maven的setting文件

 

        <server>
        <id>releases</id>
        <username>admin</username>
        <password>admin123</password>
        </server>
        

        <server>
        <id>snapshots</id>
        <username>admin</username>
        <password>admin123</password>
        </server>
    </servers>

如上所示在servers中添加

 

<server>
     <id>tomcat7</id>
   <username>admin</username>
   <password>admin</password>
</server>

 

 

 

 

 

 

 

 

 

三修改项目的pom文件

 

  <build>
		<!-- 配置插件 -->
		<plugins>
			 <plugin>
				<groupId>org.apache.tomcat.maven</groupId>
				<artifactId>tomcat7-maven-plugin</artifactId>
				<configuration>
					 <url>http://192.168.232.129:8080/manager/text</url> 
                	   <server>tomcat7</server>
                	   <username>admin</username>  
            		   <password>admin</password>  
				</configuration>
			</plugin> 
		</plugins>
	</build>

run as

 

"tomcat7:deploy"

这里一定要注意,原tomcat是有Root路径的,如果有ROOT要用

"tomcat7:redploy"的方式进行部署,不然就不生效

就可以进行热部署了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值