1. Publish To A Local Maven Repository With SBT

    The Simple Build Tool SBT to build Scala projects is simple most of the time, but if you need something special it can become hard to configure. Documentation is quite well, but not very detailed. More often than not I found me googling some receipts and follow some iterations of trial and error before I finally succeeded. Since I use Scala in real life commercial projects I’m oft confronted with scepticism about the ability to integrate with Java, Maven, Hudson, you name it. Then, I have no choice but to make it work for the environment. Changing the environment is not an option, not in the current phase when Scala is still not widely in use in the industry.

    Here is a working receipt for XSBT (tested with 0.11.0)  to “publish-local” to a local Maven repository at “~/.m2” instead to the usual local Ivy repository at “~/.ivy2”. You should add the following expressions to your “build.sbt”.

    // publish to local ~/.m2
    publishMavenStyle := true

    otherResolvers := Seq(Resolver.file("dotM2",

    file(Path.userHome + "/.m2/repository")))

    publishLocalConfiguration <<=
      (packagedArtifacts, deliverLocal, ivyLoggingLevel) map { 
        (arts, _, level) => new PublishConfiguration(None, "dotM2", arts, List[String](), level)
      }

Powered by Tumblr; designed by Adam Lloyd and Ingo Schramm.