1.Tomcat conf 下的tomcat-users.xml 增加

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

启动tomcat7,然后访问 http://localhost:8080/manager/html,输入admin/password,如果出现以下界面,表示tomcat一切OK

如果是Tomcat6 http://localhost:8080/manager

2.在Maven的conf目录中的setting.xml servers节点增加

<server>
<id>healthpad</id>
<username>admin</username>
<password>password</password>
</server>

3.pom 配置

<build>
<finalName>org.tinygroup.studytiny</finalName>
<pluginManagement>
<plugins>
<!-- <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0-beta-1</version> </plugin> --> <plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>myserver</server>
<username>admin</username>
<password>admin</password>
</configuration>
</plugin>
</plugins>
<!-- 注释掉原来的调用Jetty的地方 -->
<!-- <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId>
<version>6.1.26</version> <dependencies> <dependency> <groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api-2.5</artifactId> <version>6.1.14</version> </dependency>
</dependencies> <configuration> <webApp>${basedir}/target/${project.artifactId}</webApp>
<contextPath>/${project.artifactId}</contextPath> <scanIntervalSeconds>10</scanIntervalSeconds>
<stopKey>foo</stopKey> <stopPort>9999</stopPort> </configuration> <executions>
<execution> <id>start-jetty</id> <phase>pre-integration-test</phase> <goals>
<goal>run</goal> </goals> <configuration> <scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon> </configuration> </execution> <execution> <id>stop-jetty</id>
<phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution>
</executions> </plugin> --> </pluginManagement>
</build>

4.

Tomcat6 在Url中输入 http://localhost:8080/manager

右击Java项目,运行 输入 在Goals中添加:package tomcat:redeploy

5.异常解决

  • A.Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project healthpad:Cannot invoke Tomcat manager:Server returned HTTP response code:401for URL: http://localhost:8080/manager/html/deploy?path=%2FmkyWebApp&war= -> [Help 1]
    这种问题在 pom.xml中增加 username password

<configuration>
  <url>http://localhost:8080/manager/html</url>
  <server>healthpad</server>
  <username>admin</username> 
  <password>password</password> 
</configuration>

  • B.

如果是403,请手工在浏览器中访问

http://localhost:8080/manager/html/deploy  调整 tomcat下的tomcat-users.xml 角色权限
  • C.
    Cannot invoke Tomcat manager: Error writing to server

我遇到过跟你一样的提示,myeclipse10+tomcat7+maven3,我的原因还是在pom文件上,使用tomcat6的时候,配置如下:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<server>tomcat</server>
<url>http://localhost/manager/html</url>
<path>/</path>
</configuration>
</plugin>
如果是tomcat7或者tomcat8的话,url必须改成这样
<url>http://localhost/manager/text</url>
才行
希望我的回答对你有帮助,我也是刚开始使用maven

  • 还有一个是拒绝连接,原因就是tomcat 没有启动

Maven 配置Tomcat的更多相关文章

  1. Maven 配置tomcat插件

    使用tomcat插件来访问maven 1 先下载tomcat插件(在pom中配置) <!-- 配置Tomcat插件 --> <plugin> <groupId>or ...

  2. Maven 配置tomcat和findbug插件(在eclipse建立的项目中)

    tomcat插件 a)        tomcat的maven插件可以在tomcat的官网上寻找,这就是tomcat插件的plugin b)        将tomcat的plugin配置到项目的po ...

  3. Maven配置tomcat和jetty插件来运行项目

    针对eclipse中的Run on Server有些情况下并不是那么好操作,比如配置maven下的springmvc插件,如果使用此方法运行会很容易出现组件缺少导致错误出现一大堆的问题. 那么针对这种 ...

  4. Maven -Maven配置tomcat插件 两种

    Maven Tomcat插件现在主要有两个版本,tomcat-maven-plugin和tomcat7-maven-plugin,使用方式基本相同. tomcat-maven-plugin 插件官网: ...

  5. Java Web入门学习(四)Eclipse与Maven、Tomcat整合配置

    Java Web学习(四)Eclipse与Maven整合配置 一.准备工作 1.Tomcat 8.5.15 2.Maven3.5 3.Eclipse Neon.3 Release (4.6.3) 二. ...

  6. maven打包 tomcat运行pom配置 或 打成jar包

    maven打包 tomcat运行pom配置,同时还需要配置org.apache.tomcat.maven插件,这里省略. <groupId>com.company</groupId& ...

  7. IntelliJ IDEA 2017.2.6 x64 配置 tomcat 启动 maven 项目

    IntelliJ IDEA 2017.2.6 x64 配置 tomcat 启动 maven 项目 1.确认 IDEA 是否启用了 tomcat 插件 2.添加 tomcat 选择 tomcat 存放路 ...

  8. Intellij IDEA创建的Web项目配置Tomcat并启动Maven项目

    本篇博客讲解IDEA如何配置Tomcat. 大部分是直接上图哦. 点击如图所示的地方,进行添加Tomcat配置页面 弹出页面后,按照如图顺序找到,点击+号 tomcat Service -> L ...

  9. JavaWeb 之Ubuntu intelliJ 新建maven项目及配置tomcat

    一. 破解安装 intelliJ 下载网址:https://www.jetbrains.com/idea/ 破解激活:https://www.cnblogs.com/tanrong/p/7309343 ...

随机推荐

  1. Spring Boot - 依赖注入

    @Autowired 查找被注解的变量类型,找到所有此类型的构建或此类型子类的构建 如果一个也没有找到,看required参数,false则用null,true则失败(默认,即spring会启动失败) ...

  2. C语言顺序结构和分支结构总结

    1. 本章学习总结 1.1 思维导图 1.2 本章学习体会及代码量学习体会 1.2.1 学习体会 感觉学的内容比较基础,也是日后编程的基石.今后还应多加练习,能够更自如地运用,避免低级错误,一步步地提 ...

  3. 趣图:当我捕获Bug的时候

      趣图:当我以为已捕获了所有可能的异常...的时候 趣图:程序员调 Bug 的感觉,就是这样的

  4. [译文]casperjs 的API-casper模块

    Casper class: 可以通过这个模块的create()方法来获取这个模块的一个实例,这是最容易的: var casper = require('casper').create(); 我们也可以 ...

  5. luogu4074 [WC2013]糖果公园(树上带修莫队)

    link 题目大意:给一个树,树上每个点都有一种颜色,每个颜色都有一个收益 每次修改一个点上的颜色 或询问一条链上所有颜色第i次遇到颜色j可以获得w[i]*v[j]的价值,求链上价值和 题解:树上带修 ...

  6. 基础篇:6.5)形位公差-基本规则 Basic Rules

    本章目的:述说形位公差的基本规则 1.代表规则的修正符号与使用情况: 使用情况举例: 2  有关术语 为了明确线性尺寸公差与形位公差之间关系,对尺寸术语将作进一步论述与定义. //无需强记,但希望现有 ...

  7. 进阶篇:5.3.1)均方根法(Root-Sum-Squares,RSS)

    本章目的:了解均方根法,运用均方根法. 1.定义 均方根法(Root-Sum-Squares,RSS):均方根法是统计分析法的一种,是把尺寸链中的各个尺寸公差的平方之和再开根即得到关键尺寸的公差. 其 ...

  8. Angular material mat-icon 资源参考_Toggle

    ul,li>ol { margin-bottom: 0 } dt { font-weight: 700 } dd { margin: 0 1.5em 1.5em } img { height: ...

  9. ResNet详解(转)

    本篇文章涉及到的文献 Residual Network(ResNet) Deep Residual Learning for Image Recognition[arXiv:1512.03385] I ...

  10. nodejs之socket.io 聊天实现

    写在前面:最近很火的“996”话题,可谓是引起一片热议,马老师说:能够996应该是幸运的,996是对奋斗者的一种机遇(记得不是很清楚).996缺少的是自己的空闲时间了,当我是空闲的时候偶尔996挺好的 ...