IntelliJ IDEA使用maven实现tomcat的热部署
程序员文章站
2023-12-20 08:19:22
在tomcat的conf目录 tomcat-users.xml配置以下内容(标签内 ),用于...
在tomcat的conf目录 tomcat-users.xml配置以下内容(<tomcat-users>标签内</tomcat-users>),用于部署:
<role rolename="manager"/> <role rolename="manager-gui"/> <role rolename="admin"/> <role rolename="admin-gui"/> <role rolename="manager-script"/> <user username="tomcat" password="tomcat" roles="admin-gui,admin,manager-gui,manager,manager-script"/
启动tomcat,访问 http:ip:8080/manager 验证tomcat用户是否配置成功
在maven工程的pom.xml中配置插件
<plugin> <groupid>org.apache.tomcat.maven</groupid> <artifactid>tomcat7-maven-plugin</artifactid> <configuration> <port>8080</port> <path>/mvc</path> <url>http://192.168.43.128:8080/manager/text</url> <username>tomcat</username> <password>tomcat</password> </configuration> </plugin>
运行配置
点击run-->edit configurations
点击+号,选择maven ,
输入信息
name 给运行配置取的名称
working directory(工程目录)
command line 命令 tomcat7:deploy 或 tomcat7:redeploy
点击确定,保存。
在run菜单下找到刚做好的配置,运行
[info] scanning for projects... [warning] [warning] some problems were encountered while building the effective model for org.jstudioframework:jstudio-mvc:war:1.0-snapshot [warning] 'build.plugins.plugin.version' for org.apache.tomcat.maven:tomcat7-maven-plugin is missing. @ line 91, column 21 [warning] [warning] it is highly recommended to fix these problems because they threaten the stability of your build. [warning] [warning] for this reason, future maven versions might no longer support building such malformed projects. [warning] [info] [info] ------------------------------------------------------------------------ [info] building jstudio-mvc 1.0-snapshot [info] ------------------------------------------------------------------------ [info] [info] >>> tomcat7-maven-plugin:2.2:redeploy (default-cli) @ jstudio-mvc >>> [info] [info] --- maven-resources-plugin:2.5:resources (default-resources) @ jstudio-mvc --- [debug] execute contextualize [info] using 'utf-8' encoding to copy filtered resources. [info] copying 5 resources [info] [info] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ jstudio-mvc --- [info] nothing to compile - all classes are up to date [info] [info] --- maven-resources-plugin:2.5:testresources (default-testresources) @ jstudio-mvc --- [debug] execute contextualize [info] using 'utf-8' encoding to copy filtered resources. [info] skip non existing resourcedirectory e:\jstudioproject1\jstudiomvc\src\test\resources [info] [info] --- maven-compiler-plugin:2.3.2:testcompile (default-testcompile) @ jstudio-mvc --- [info] nothing to compile - all classes are up to date [info] [info] --- maven-surefire-plugin:2.14:test (default-test) @ jstudio-mvc --- [info] tests are skipped. [info] [info] --- maven-war-plugin:2.1.1:war (default-war) @ jstudio-mvc --- [info] packaging webapp [info] assembling webapp [jstudio-mvc] in [e:\jstudioproject1\jstudiomvc\target\jstudio-mvc-1.0-snapshot] [info] processing war project [info] copying webapp resources [e:\jstudioproject1\jstudiomvc\src\main\webapp] [info] webapp assembled in [177 msecs] [info] building war: e:\jstudioproject1\jstudiomvc\target\jstudio-mvc-1.0-snapshot.war [warning] warning: selected war files include a web-inf/web.xml which will be ignored (webxml attribute is missing from war task, or ignorewebxml attribute is specified as 'true') [info] [info] <<< tomcat7-maven-plugin:2.2:redeploy (default-cli) @ jstudio-mvc <<< [info] [info] --- tomcat7-maven-plugin:2.2:redeploy (default-cli) @ jstudio-mvc --- [info] deploying war to http://192.168.43.128:8080/mvc slf4j: failed to load class "org.slf4j.impl.staticloggerbinder". slf4j: defaulting to no-operation (nop) logger implementation slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder for further details. uploading: http://192.168.43.128:8080/manager/text/deploy?path=%2fmvc&update=true uploaded: http://192.168.43.128:8080/manager/text/deploy?path=%2fmvc&update=true (7445 kb at 7083.3 kb/sec) [info] tomcatmanager status code:200, reasonphrase:ok [info] ok - deployed application at context path /mvc [info] ------------------------------------------------------------------------ [info] build success [info] ------------------------------------------------------------------------ [info] total time: 14.720s [info] finished at: sun jul 23 19:35:01 cst 2017 [info] final memory: 15m/322m [info] ------------------------------------------------------------------------ process finished with exit code 0
发布成功。
在tomcat的manager可以看到新发布的应用。
方法2:
这几个标红的菜单都能远程发布
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
推荐阅读
-
IntelliJ IDEA使用maven实现tomcat的热部署
-
IntelliJ IDEA 中使用jRebel进行 Java 热部署教程图解
-
IntelliJ IDEA 中使用jRebel进行 Java 热部署教程图解
-
Maven实现热部署需要的依赖
-
在eclipse中使用Maven分模块搭建SSM框架,创建jar、war、pom工程模块教学,项目的热部署,需要的可以留下邮箱,给大家发整理过的Maven笔记
-
SpringBoot项目在IntelliJ IDEA中实现热部署
-
【IDEA使用技巧】(5) —— IntelliJ IDEA集成Tomcat部署Maven Web项目
-
intellij idea 使用Tomcat部署的项目位置在哪
-
IDEA是如何部署tomcat项目的,了解一下它的实现原理
-
转载:Maven多模块项目 eclipse热部署 Maven项目实现 tomcat热部署