WebDav Plugin 4 SBT

Dev At CloudBees


When publishing artifact to a WebDav location, by default, the publish task will not create the required collections which will cause the publish task to fail when the required collections do not exist. You could create the directories manually by mounting the WebDav location locally or by using 'curl', but this is tedious. Especially in a CI environment, you want everything to run automatically.

So, the goal of this project was "to create a plugin for SBT which creates the required collections (folders) on a WebDav location, for example CloudBees, so that SBT can publish the artifact to the WebDav location."


This plugin adds the following tasks

  • mkcol - Uses the WebDav MKCOL command to create all collections (folder) which are required to be able to publish the project artifacts to a WebDav location. It will only create the collections which do not exist yet.

  • publish - Adapts the default publish task to automatically run mkcol before publishing the artifacts.


To use the plugin, add these lines to your project/plugins.sbt or to the global .sbt/plugins/build.sbt:

resolvers += "DiversIT repo" at ""

addSbtPlugin("eu.diversit.sbt.plugin" % "webdav4sbt" % "1.3")

In your project's build.sbt Add to the top of your project's build.sbt:

import eu.diversit.sbt.plugin.WebDavPlugin._

and anywhere within the same file add:

seq(WebDav.globalSettings : _*)


seq(WebDav.scopedSettings : _*)

The plugin was build for both Scala 2.9.2 and 2.10.0 using SBT 0.12.2

Publishing Java artifacts with SBT

Version 1.1 added support for publishing plain Java artifacts. In contrast to Scala artifacts, Java artifacts do not need the Scala version in the artifact name. To disable adding the Scala version in the artifact name, add this to your build.sbt:

crossPath := false

Thanks to jplikesbikes for this contribution.


Since version 1.2, the WebDav plugin supports publishing Ivy artifacts. To publish an Ivy artifact, in your build.sbt set:

publishMavenStyle := false

Global or Scoped settings?

The plugin allows you to chose whether you would like the added tasks to be available in the global settings or in the scoped settings. Global settings means that the tasks added by this plugin are available in the global scope. So you can use it from sbt as


The plugin adapts the publish tasks, so the mkcol task is executed beforehand. So running


would always run both the mkcol and publish tasks.

Scoped settings means that the tasks added by this plugin are available under the webdav configuration. To run the tasks defined by this plugin, you have to prepend the tasks with webdav: In the sbt console, when you type webdav:<TAB> , it will show you all tasks and settings available or used by this plugin.

In scoped settings, to run the mkcol task, run


or to publish to a WebDav location and create the directories, run


With the scoped settings, when you run


it will run the normal publish task without the mkcol addition.

Publishing to WebDav

To publish to a WebDav location, like CloudBees, you need to add a publishTo configuration in your project. One way of doing that is to create a seperate publish.sbt file in your project. The advantage is that you seperate the configuration for building your project with the publish configuration in seperate files.

This is an example of a publishTo configuration for CloudBees as is used by this project. It also shows how to create a Maven Pom for your project.

credentials += (Some(new File("/private/diversit/.credentials/.credentials")) map(f => Credentials(f))).get

publishTo <<= version { v: String =>
  val cloudbees = ""
  if (v.trim.endsWith("SNAPSHOT"))
    Some("snapshots" at cloudbees + "snapshot")
    Some("releases" at cloudbees + "release")

publishMavenStyle := true

publishArtifact in Test := false

pomIncludeRepository := { x => false }

pomExtra := (
      <name>Eclipse Public License v1.0</name>
      <name>Joost den Boer</name>


This project uses the library Sardine) as a Java WebDav client.


Command to create collections (a.k.a directories) on a WebDav host. The 'MKCOL' command is currently the only WebDav command which is implemented by this plugin.


  • 1.3 (current) Fixed issue that sbtVersion should only be added for sbtPlugin projects
  • 1.2 Added support for Ivy artifacts.
  • 1.1 Added support for (Java) artifacts without Scala version.
  • 1.0 First plugin release


Thanks for their contribution:

  • jplikesbikes for crossPath support.
  • Flanker_9 for raising the Ivy issue.