Maven + WebDAV – Embedded error: Failed to transfer file: … Return code is: 405

Problem

A pom.xml file, when “mvn site:deploy” is issued, the site doesn’t deploy to the defined server and hits the HTTP error code : 405.

File : pom.xml


<project ...>
  <build>
	<extensions>
		<extension>
			<groupId>org.apache.maven.wagon</groupId>
			<artifactId>wagon-webdav-jackrabbit</artifactId>
			<version>1.0-beta-7</version>
		</extension>
	</extensions>
  </build>
  <distributionManagement>
    <site>
      <id>sitedeployment</id>
      <url>dav:http://127.0.0.1/upload-sites/</url>
    </site>
  </distributionManagement>
</project>

See full error message :


D:\workspace-new\mkyong-core>mvn site:deploy
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'site'.
[INFO] ------------------------------------------------------------------------
[INFO] Building mkyong-core
[INFO]    task-segment: [site:deploy]
[INFO] ------------------------------------------------------------------------
[INFO] [site:deploy {execution: default-cli}]
http://127.0.0.1/upload-sites/ - Session: Opened
Uploading: ./css/maven-base.css to http://127.0.0.1/upload-sites/

#http://127.0.0.1/upload-sites//./css/maven-base.css - Status code: 405
 Transfer error: org.apache.maven.wagon.TransferFailedException: 
Failed to transfer file: http://127.0.0.1/upload-sites//./css/maven-base.css. 
Return code is: 405
http://127.0.0.1/upload-sites/ - Session: Disconnecting
http://127.0.0.1/upload-sites/ - Session: Disconnected
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error uploading site

Embedded error: Failed to transfer file: http://127.0.0.1/upload-sites//./css/maven-base.css. 
Return code is: 405

Solution

You are auto deploy your site via WebDAV, and the HTTP error code 405 is means the method is not support. In summary, it means the folder you deploy is not support with WebDAV access.

To fix it, just enable WebDAV on your server “upload-sites” folder. Read following two articles to learn about integrate Maven with WebDAV :

  1. How to enable WebDAV on Apache Server
  2. mvn site:deploy + WebDAV example

One comment on “Maven + WebDAV – Embedded error: Failed to transfer file: … Return code is: 405

Leave a Comment

Your email address will not be published. Required fields are marked *