I'm trying to deploy a war with mvn tomcat:deploy
and I get
Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project navigator-native: Cannot invoke Tomcat manager: Server returned HTTP response code: 401 for URL: ...//localhost:8080/manager/deploy? ...
I've already added the roles to tomcat-users.xml :
<role rolename="manager"/>
<role rolename="admin"/>
<user username="admin" password="password" roles="admin,manager"/>
But don't want to modify the project's POM.xml, so what is the default server used for the plugin? I've tried adding
<server>
<id>localhost</id>
<username>admin</username>
<password>password</password>
</server>
but it doesn't work
Default url is http://localhost:8080/manager
per Tomcat 6 maven plugin docs. Not sure if it's the same for tomcat 7.
For manager credentials, you add a server block to the ${user.home}/.m2/settings.xml
file. Then you need to define the server ID by specifying the <server>
element in the Tomcat plugin config, or on the command line:
mvn tomcat:deploy -Dmaven.tomcat.server=localhost <otherPropertiesHere>
The above assumes the server ID is "localhost" as shown in the original question.