Sbt publishing to repository
May 9, 2018If 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","10.0.1.23", "admin", "somepass")
//or use a file
//credentials += Credentials(Path.userHome / ".ivy2" / ".archiva-cred")
publishMavenStyle := true
publishArtifact in Test := false
publishTo := {
val archiva = "http://10.0.1.23:9001/repository/"
Some("internal" at archiva + "internal")
}
important points:
- the hostname in the credentials part should not contain the port
- the realm is important, it should be like it’s shown here (substitute ‘internal’ for your repo name if it’s different)
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
host=10.0.1.23
user=admin
password=somepassword
Tags: #programming #ops