Status code 401 on mvn site:deploy?

Are you faced to a 401 status code when invoking mvn site:deploy?

Like this one?
Embedded error: Failed to transfer file: http://server:port/dir/projectname//./changes-report.html. Return code is: 401

Then

  1. check your pom.xml if the site-id in the distribution-section of the pom.xml matches any server-id setting in your settings.xml.
  2. check if the password is still valid!

For example the following pom.xml and settings.xml DO NOT match. Note the difference between BARNAME and FOONAME! This cannot work.

pom.xml:

   <distributionManagement>
     <site>
       <!-- does not match FOONAME -->
       <id>BARNAME</id>
       <url>${site-base-url}/projectname/</url>
     </site>
   </distributionManagement>

.m2/settings.xml:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <servers>
    <server>
       <!-- does not match BARNAME -->
      <id>FOONAME</id>
      <username>XXXXXX</username>
      <password>XXXXXX</password>
    </server>
  </servers>
</settings>
Advertisements