【maven】进行项目的热部署

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/worn_xiao/article/details/79117762

一  修改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"的方式进行部署,不然就不生效

就可以进行热部署了。

展开阅读全文

没有更多推荐了,返回首页