By leverage SBT and Git, it is very easy to deploy your own distributed Maven Repository.
Publishing to Maven Repository
publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/mvn-repo")))
publishTo defines the local directory for your Maven Repository. Alternatively you can also publish to http or ssh server. But that is out of the scope of this post.
To publish, run
The published artifacts will be build for the scala version you use. You can specify the scala version in your
scalaVersion := "2.11.6"
To support multiple incompatible Scala versions, use command:
You can also specify the Scala versions for cross publishing in your
crossScalaVersions := Seq("2.9.3", "2.10.6")
Push to servers
For me I push my personal Maven Repository to both Github and Bitbucket:
Use in Your Project
To use the Maven Repository in your project, you need to add the resolvers:
resolvers += "janzhou" at "https://raw.githubusercontent.com/janzhou/mvn-repo/master"
Add artificial build for the scala version used:
libraryDependencies += "org.janzhou" %% "native" % "0.1.0"
Or specify the scala version:
libraryDependencies += "org.janzhou" % "native_2.11" % "0.1.0"
Notice the difference between %% and %