我正在使用apache tomcat maven插件將war文件部署到遠程tomcat服務器。這裏是我的pom.xml的插件配置,Tomcat7 maven插件部署failonerror
<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] <role rolename="manager-gui"/>
[INFO] <user username="tomcat" password="s3cret" roles="manager-gui"/>
[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
,以便我知道部署何時失敗?
這是舊的。顯然'org.apache'是目前的一個。 http://mojo.codehaus.org/tomcat-maven-plugin/ – anoopelias
Anoopelias,你是對的,org.apache是最新的,但它不會導致部署錯誤的BUILD FAILURE,org.codehaus會。 –