pom.xml tomcat 配置信息
 <properties><project.build.sourceEncoding>utf8</project.build.sourceEncoding>//编码格式
  <finalName>shiro</finalName>//项目名称
 </properties>
 <!-- 插件 -->
<url>http://mvnrepository.com/</url>
<repositories>
<repository>
<id>people.apache.snapshots</id>
<url>http://mvnrepository.com/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories> <pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshots</name>
<url>http://mvnrepository.com/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<finalName>${finalName}</finalName>//打包项目名称
31 <plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<url>http://192.168.1.3:8080/manager/text</url> //tomcat管理页面路径,tomcat7
<path>/${finalName}</path> //项目访问路径
<server>com.self.deploy</server>
<username>admin</username>
<password>admin</password>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin> </plugins>
<!-- mybatis的映射配置文件.xml -->
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>

conf/tomcat-users.xml 用户权限配置,与webapp/manager/WEB-INF/web.xml中的role对应,下文异常2

 <tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>
</tomcat-users>

maven   conf\settings.xml

<server><id>com.self.deploy</id><username>admin</username><password>admin</password></server>

注:id与pom.xml<server>,账户密码一致

tomcat7:deploy  部署

tomcat7:redeploy 重新部署

异常1:[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:redeploy (default-cli) on project shiro: Cannot invoke Tomcat manager: Connection to http://192.168.1.3:8080 refused: Connection refused: connect -> [Help 1]

原因:部署前未启动远程tomcat,部署前需要先启动远程tomcat

异常2:权限不足

 [INFO] tomcatManager status code:, ReasonPhrase:Unauthorized
[INFO] <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
[INFO] <html>
[INFO] <head>
[INFO] <title> Unauthorized</title>
[INFO] <style type="text/css">
[INFO] <!--
[INFO] BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;font-size:12px;}
[INFO] H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
[INFO] PRE, TT {border: 1px dotted #525D76}
[INFO] A {color : black;}A.name {color : black;}
[INFO] -->
[INFO] </style>
[INFO] </head>
[INFO] <body>
[INFO] <h1> Unauthorized</h1>
[INFO] <p>
[INFO] You are not authorized to view this page. If you have not changed
[INFO] any configuration files, please examine the file
[INFO] <tt>conf/tomcat-users.xml</tt> in your installation. That
[INFO] file must contain the credentials to let you use this webapp.
[INFO] </p>
[INFO] <p>
[INFO] For example, to add the <tt>manager-gui</tt> role to a user named
[INFO] <tt>tomcat</tt> with a password of <tt>s3cret</tt>, add the following to the
[INFO] config file listed above.
[INFO] </p>
[INFO] <pre>
[INFO] &lt;role rolename="manager-gui"/&gt;
[INFO] &lt;user username="tomcat" password="s3cret" roles="manager-gui"/&gt;
[INFO] </pre>
[INFO] <p>
[INFO] Note that for Tomcat onwards, the roles required to use the manager
[INFO] application were changed from the single <tt>manager</tt> role to the
[INFO] following four roles. You will need to assign the role(s) required for
[INFO] the functionality you wish to access.
[INFO] </p>
[INFO] <ul>
[INFO] <li><tt>manager-gui</tt> - allows access to the HTML GUI and the status
[INFO] pages</li>
[INFO] <li><tt>manager-script</tt> - allows access to the text interface and the
[INFO] status pages</li>
[INFO] <li><tt>manager-jmx</tt> - allows access to the JMX proxy and the status
[INFO] pages</li>
[INFO] <li><tt>manager-status</tt> - allows access to the status pages only</li>
[INFO] </ul>
[INFO] <p>
[INFO] The HTML interface is protected against CSRF but the text and JMX interfaces
[INFO] are not. To maintain the CSRF protection:
[INFO] </p>
[INFO] <ul>
[INFO] <li>Users with the <tt>manager-gui</tt> role should not be granted either
[INFO] the <tt>manager-script</tt> or <tt>manager-jmx</tt> roles.</li>
[INFO] <li>If the text or jmx interfaces are accessed through a browser (e.g. for
[INFO] testing since these interfaces are intended for tools not humans) then
[INFO] the browser must be closed afterwards to terminate the session.</li>
[INFO] </ul>
[INFO] <p>
[INFO] For more information - please see the
[INFO] <a href="/docs/manager-howto.html">Manager App HOW-TO</a>.
[INFO] </p>
[INFO] </body>
[INFO] </html>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

最新文章

  1. [ACM_几何] Pipe
  2. MVC设计模式与三层架构
  3. 数据源和JNDI的关系:
  4. bat 炸弹升级
  5. [51单片机] EEPROM 24c02 + 数码管 + 中断 [统计开机次数]
  6. Math对象常用方法汇总
  7. HTTP基础02--HTTP协议简介
  8. angularJs编写多指令的情况
  9. 几种Android数据序列化方案
  10. C语言学习之交换(冒泡)排序
  11. Python——使用高德API获取POI(以深圳南山医疗保健服务POI为例)
  12. 【转载】FPGA算法映射要点
  13. CodeFirst+MySql开发
  14. android:Android中用文件初始化sqlite数据库(zz)
  15. HDU 5702 Solving Order
  16. tips: javascript 参数传递含有空格怎么办?
  17. 51nod1312 最大异或和
  18. 获取矩形局域的方法,Rect、Bounds、Point
  19. multiprocessor(下)
  20. python迭代、可迭代对象、迭代器及生成器

热门文章

  1. 05.配置为开发模式、配置静态资源locations、自定义消息转化器、FastJson
  2. ROS环境下使用Wireshark抓包(网桥)
  3. 【leetcode】699. Falling Squares
  4. S1.2 Python开发规范指南
  5. Ant Design(ui框架)
  6. Apache + Tomcat 集群的配置
  7. JS:收集的一些Array及String原型对象的扩展实现代码
  8. Linux下安装xwindow图形界面
  9. Centos7从零开始】Centos 下硬盘分区的最佳方案
  10. SSL证书部署HTTPS站点Apache/Nginx配置