Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using mvn deploy via webdav: directory creation

I managed to setup maven so it automatically uploads the latest snapshot of our software to our public maven repository. This works fine so far, there is only a minor shortcoming that I just can not handle:

When deploying a new Snapshot, say for example: <version>1.2-SNAPSHOT</version> a directory named 1.2-SNAPSHOT has to be present on our webserver's maven directory, otherwise maven will fail, stating:

Failed to deploy artifacts: Could not transfer artifact ... from/to basex.mvn (http://abc.de/webdav/): Access denied to: http://abc.de/webdav/1.2-SNAPSHOT/...

As usually when starting a new snapshot this very directory is not yet present so I end up creating it manually.

Do you have any ideas on how to come around this and make maven create this folder?

like image 941
michael Avatar asked Nov 14 '22 16:11

michael


1 Answers

Are you sure that it is not a server side problem? I deployed a some libraries using Webdav (over HTTPS) and first time (with directory creation) it worked.

The Pom.xml should contain a description of the distribution server.

<distributionManagement>
   <repository>
      <id>RepoId</id>
      <name>Name of the Maven repository</name>
      <url>dav:https://thewebdavurl/</url>
      <uniqueVersion>false</uniqueVersion>
   </repository>
</distributionManagement>

To enable directory creation, you might need to log on the server. To do this you need to add in the server part of the setting.xml the credentials for RepoId (see id of the repository in the pom).

<server>
   <id>RepoId</id>
   <username>login</username>
   <password>pass</password>
</server>
like image 110
YMomb Avatar answered Dec 17 '22 12:12

YMomb