[maven]maven插件 tomcat7-maven-plugin 的使用
2024-10-06 14:51:33
使用 tomcat7-maven-plugin,可以将tomcat内嵌到web项目中,直接运行webapp项目。
第一步、pom.xml的配置:
<build>
<plugins> <plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version> <configuration>
<path>/</path> <!-- 项目访问路径 本例:localhost:9090, 如果配置的aa,则访问路径为localhost:9090/aa -->
<port>9090</port>
<uriEncoding>UTF-8</uriEncoding><!-- 非必需项 -->
</configuration>
</plugin> </plugins>
</build>
第二步、配置maven的运行参数:
添加Maven,并在Command line中输入:
clean tomcat7:run
点击保存,然后run。
访问http://localhost:9090
tomcat7-maven-plugin 常用命令:
tomcat7:run 启动嵌入式tomcat ,并运行当前项目
tomcat7:deploy --部署一个web war包
tomcat7:reload --重新加载web war包
tomcat7:start --启动tomcat
tomcat7:stop --停止tomcat
tomcat7:undeploy--停止一个war包 mvn tomcat7:deploy //第一次
mvn tomcat7:redeploy//之后
//这里我要求先重新打包,并跳过测试,再部署
//第一次
mvn package -Pdevelop -Dmaven.skip.test=true tomcat7:deploy //之后
mvn package -Pdevelop -Dmaven.skip.test=true tomcat7:redeploy
拓展:maven的 java 编译插件
<build>
<plugins>
<!--java 编译插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source> <!--输入对应的编码版本号 -->
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
这是我们常用的编译方式,配合tomcat使用。
最新文章
- iOS10推送通知适配
- 仿h5拖拽
- MySQL使用正则表达式比较字段中的数字
- SQL Server 2008 R2——ROW_NUMBER() 去掉不同行中相同列的重复内容
- Shell_Shell调用SQLPlus简介(案例)
- SqlServer:CTE函数处理递归(WITH语法)
- 数据库下载word预览功能的研究
- OCP读书笔记(21) - 题库(ExamA)
- asp.net core 2.0+sqlsugar搭建个人网站系列(0)
- 从length与length()开始谈Java
- 【Service Fabric】小白入门记录 本地Service Fabric集群安装及设置
- 理解Linux文档的默认安全机制、隐藏属性、特殊权限,妈妈在也不用担心你从删库到跑路!!!
- Day2----《Pattern Recognition and Machine Learning》Christopher M. Bishop
- [Swift]LeetCode560. 和为K的子数组 | Subarray Sum Equals K
- 线程基础:多任务处理——MESI协议以及带来的问题:伪共享
- pip更新到18版本后使用pycharm更新问题:module &#39;pip&#39; has no attribute &#39;main&#39;
- iOS-方法之+ initialize 与 +load
- Java编程的逻辑 (68) - 线程的基本协作机制 (下)
- Struts在Web.xml中的配置及Struts1和Struts2的区别
- java 将class打包成jar包
热门文章
- bash基础——grep、基本正则表达式、扩展正则表达式、fgrep
- python-----opencv截取按帧截取视频
- OpenCV读取图像问题:OpenCV(3.4.3) D:\Build\OpenCV\opencv-size.width0 && size.height0 in function 'cvimshow'
- 如何实现数组和 List 之间的转换?(未完成)
- Linux下Mysql每天自动备份
- exception about Kernel Panic // dirperm1 breaks the protection by the permission bits on the lower branch
- Ubuntu 执行 apt-get install &;#215;&;#215;&;#215; 报错
- [AH2017/HNOI2017]抛硬币(扩展lucas)
- [git]用户名,邮箱
- 安装Discuz