3

我正在使用 apache tomcat maven 插件将战争文件部署到远程 tomcat 服务器。这是我在 pom.xml 中的插件配置,

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.1</version>
    <configuration>
        <url>http://localhost:8080/manager/text</url>
        <server>INT</server>
    </configuration>
</plugin>

当我运行 maven 构建并且由于某种原因部署失败时,maven 构建仍然显示BUILD SUCCESS.

[INFO] tomcatManager status code:401, ReasonPhrase:Unauthorized
[INFO] <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/h
tml4/strict.dtd">
[INFO] <html>
[INFO]  <head>
[INFO]   <title>401 Unauthorized</title>
[INFO]   <style type="text/css">
[INFO]     <!--
[INFO]     BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-colo
r: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>401 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 7 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 fo
r
[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 st
atus
[INFO]           pages</li>
[INFO]       <li><tt>manager-script</tt> - allows access to the text interface a
nd the
[INFO]           status pages</li>
[INFO]       <li><tt>manager-jmx</tt> - allows access to the JMX proxy and the s
tatus
[INFO]           pages</li>
[INFO]       <li><tt>manager-status</tt> - allows access to the status pages onl
y</li>
[INFO]     </ul>
[INFO]    <p>
[INFO]     The HTML interface is protected against CSRF but the text and JMX int
erfaces
[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 ei
ther
[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
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.216s
[INFO] Finished at: Tue Jun 25 09:59:51 PST 2013
[INFO] Final Memory: 9M/23M
[INFO] ------------------------------------------------------------------------
D:\Workspace\SVN\webroot>

org.codehaus.mojo我注意到以前的插件不是这种情况。有什么方法可以设置一个FailOnError,以便我知道部署何时失败?

4

2 回答 2

0

我的构建中有同样的问题。对我来说它看起来像错误。

这个插件适用于我的Tomcat7,没有任何配置更改:

<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
于 2013-07-09T11:13:08.990 回答
0

在 2.2 版中,此错误已修复。

<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
于 2016-02-23T04:03:08.267 回答