【问题标题】:tomcat7 deployment using tomcat7 maven plugin not working使用tomcat7 maven插件的tomcat7部署不起作用
【发布时间】:2012-08-29 22:55:20
【问题描述】:

我正在尝试使用 eclipse maven 插件,但是在使用命令时:

tomcat7:deploy 我正在构建成功,其中包含大量解释添加用户的 html 输出,我已将用户添加到仅使用管理器脚本的 tomcat。 并将其添加到 maven 中 settings.xml 的用户。

我做错了什么?

来自 tomcat 日志

127.0.0.1 - - [29/Aug/2012:23:50:34 +0100] "PUT /manager/text/deploy?path=%2F HTTP/1.1" 401 2486

我的配置

pom.xml

        <plugins>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.0-SNAPSHOT</version>
            <configuration>
                <server>tomcat_7</server>
                <port>8180</port>
                <path>/</path>
                <url>http://localhost:8180/manager/text</url>
            </configuration>
          </plugin>
    </plugins>

settings.xml

<server>
  <id>tomcat_7</id>
  <username>admin</username>
  <password>secret</password>
</server>

tomcat-users.xml

<user username="admin" password="secret" roles="manager-script" />

【问题讨论】:

  • 根据 401 错误代码,看起来身份验证不起作用?您是否仅使用浏览器检查过?
  • 我尝试使用浏览器访问 /manager/text 并收到一条消息说失败。在不使用 eclipse 的情况下使用 tomcat 插件,但仅使用命令行部署工作正常。任何想法为什么它不能通过 Eclipse 工作。

标签: eclipse eclipse-plugin maven-3 tomcat7 m2eclipse


【解决方案1】:

好的,所以我设法解决了这个问题。

我检查了 eclipse 认为 maven settings.xml 文件在哪里。这是主要问题,没有 settings.xml 文件,因此没有身份验证。我将文件复制到eclipse中指定的路径。

现在构建成功。

【讨论】:

    【解决方案2】:

    删除

    <server>tomcat_7</server>
    

    并添加

    <username>admin</username>
    <password>s3cret</password>
    

    排除任何 maven settings.xml 问题。

    【讨论】:

      猜你喜欢
      • 2012-10-26
      • 2011-11-22
      • 1970-01-01
      • 2013-06-21
      • 1970-01-01
      • 1970-01-01
      • 2014-07-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多