maven发布项目到本地tomcat
来源:互联网 发布:网络销售文人字画 编辑:程序博客网 时间:2024/06/02 02:03
添加plugin:
<plugin><!-- 使用maven的tomcat插件打包并部署war文件到tomcat --><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><version>2.0</version><configuration> <path>/${project.build.finalName}</path> <url>http://localhost:8080/manager/text</url><server>tomcat</server><username>tomcat</username><password>password</password></configuration></plugin><plugin><!-- 这里版本为1.7 请注意编译版本 否则会报错 --><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.1</version><configuration><source>1.7</source><target>1.7</target><encoding>${project.build.sourceEncoding}</encoding></configuration></plugin>
其中用户名和密码的配置可以理解为maven为了和本地tomcat打交道而由tomcat的配置的口令,首先要在tomcat安装目录下conf文件夹下的tomcat-users.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.--><!-- NOTE: The sample user and role entries below are wrapped in a comment and thus are ignored when reading this file. Do not forget to remove <!.. ..> that surrounds them.--> <!-- maven发布到tomcat --> <role rolename="manager-gui"/> <role rolename="manager-script"/> <user username="tomcat" password="password" roles="manager-gui, manager-script"/> </tomcat-users>
这里配置好后,启动tomcat,在浏览器输入localhost:8080/manage会让你输入用户名密码,输入这里配置的用户名/密码,若验证通过会跳到tomcat web application Manager页面,就说明该配置是成功的,就可以往下进行;若验证不通过,会跳到一个说明页面,里面有对各role的说明(想了解上面role的童鞋请自行查看),此时再修改配置,直至验证成功。
<servers> <!-- server | Specifies the authentication information to use when connecting to a particular server, identified by | a unique name within the system (referred to by the 'id' attribute below). | | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are | used together. | <server> <id>deploymentRepo</id> <username>repouser</username> <password>repopwd</password> </server> --> <server> <id>tomcat</id> <username>tomcat</username> <password>password</password> </server> </servers>配置maven的settings.xml文件,至于settings.xml文件在你机器的哪里,请自行查找。这里的用户名和密码都与tomcat-users.xml中验证通过的用户名密码一致,这里的‘id’要与pom文件的<server>tomcat</server>一致,当然pom文件的用户名和密码也要对应。
共有三处进行了用户名密码配置。
选择eclipse的绿色启动按钮的下拉列表的run configurations...,新增一个maven指令“tomcat7:deploy”,运行指令前先启动tomcat,
不出意外就发布成功。
0 0
- maven发布项目到本地tomcat
- maven 发布项目到tomcat
- 发布本地项目到中央maven仓库
- 发布Maven项目到Tomcat中
- 动态发布maven项目到tomcat
- Maven项目不能发布到Tomcat问题
- 【Maven】发布项目到Tomcat中
- 将Maven项目发布到本地Maven私服Nexus
- eclipse 发布web项目到tomcat找不到本地的项目
- eclipse maven项目转web项目,发布到tomcat
- 发布本地项目和源码到maven远程库中
- 发布Android studio项目到本地Maven仓库
- IDEA将maven项目配置到本地tomcat中运行
- Eclipse将maven项目部署到本地tomcat
- Maven将web项目发布到tomcat中
- 无法将Eclipse中的maven项目发布到tomcat
- maven项目如何启动运行---发布到tomcat中
- maven发布web项目到tomcat,并启用远程调试
- 用js 触发 浏览器的下载功能下载文件
- selenium中的quit和close方法的区别
- 阿里开源数据同步工具--DataX
- Python+Selenium中级篇之3-二次封装Selenium中几个方法
- MySQL (4) 第一范式 第二范式 第三范式 BC范式
- maven发布项目到本地tomcat
- 用新语法写更简洁的ABAP代码
- Spring classPath:用法
- Spider
- 封装yolo-windows为动态链接库
- Request对象
- 大奖章 量化 数据 接口
- Android仿最新微信自定义相机(长按拍摄,轻点拍照)
- python函数返回问题