title: Tomcat-Maven 401 Error: Cannot invoke Tomcat manager
body: <p>Went through most of the errors shown in StackOverFlow and still couldn't solve it. I'm trying to deploy a SpringMVC application. But, I just can't get it to work.</p>
  
  <p>Maven Deploy Error: </p>
  
  <pre><code>[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:redeploy (default-cli) on project productmgmt: Cannot invoke Tomcat manager: Server returned HTTP response code: 401 for URL: http://localhost:8080/manager/text/deploy?path=%2Fproductmgmt&amp;war=&amp;update=true -&gt; [Help 1]
  </code></pre>
  
  <p>Pom.xml:</p>
  
  <pre><code>&lt;build&gt;
          &lt;finalName&gt;productmgmt&lt;/finalName&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;tomcat-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;url&gt;http://localhost:8080/manager/text&lt;/url&gt;
                      &lt;path&gt;/productmgmt&lt;/path&gt;
                      &lt;username&gt;admin&lt;/username&gt;
                      &lt;password&gt;password&lt;/password&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  </code></pre>
  
  <p>Tomcat-Users.xml</p>
  
  <pre><code>&lt;role rolename="admin"/&gt;
    &lt;role rolename="manager"/&gt;
    &lt;user username="admin" password="admin" roles="admin,manager"/&gt;
  &lt;/tomcat-users&gt;
  </code></pre>
  
  <p>More Information:</p>
  
  <pre><code>[ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
  </code></pre>
  
  <p>This worked for me</p>
  
  <pre><code>&lt;role rolename="manager-script"/&gt;
  &lt;role rolename="admin-script"/&gt;
  &lt;user password="password" roles="manager-script,admin-script" username="admin"/&gt;
  &lt;/tomcat-users&gt;
  </code></pre>