Sbt publishing to repository

May 9, 2018 programming ops

If you run a maven repository for your own company/projects here is how you can publish your artifacts using SBT. The repository manager I use is archiva but it should be similar for nexus etc too.

in your build.sbt file

credentials += Credentials("Repository Archiva Managed internal Repository","", "admin", "somepass")
//or use a file
//credentials += Credentials(Path.userHome / ".ivy2" / ".archiva-cred")

publishMavenStyle := true

publishArtifact in Test := false

publishTo := {
  val archiva = ""
    Some("internal"  at archiva + "internal")

important points:

If you are using a file to store your credentials (which is the better way) here is the file format

realm=Repository Archiva Managed internal Repository