Skip to content

Instantly share code, notes, and snippets.

@schleichardt
Created September 30, 2012 18:29
Show Gist options
  • Save schleichardt/3808085 to your computer and use it in GitHub Desktop.
Save schleichardt/3808085 to your computer and use it in GitHub Desktop.
import sbt._
import Keys._
import sbt.Classpaths.publishTask
/* code for https://groups.google.com/forum/?fromgroups=#!searchin/simple-build-tool/m2/simple-build-tool/BLir3V_3ajY/YQZ5vobWatoJ
title: publish-local to both .m2 and .ivy2
use "sbt pl" to publish to both local repositories
*/
object DemoBuild extends Build {
lazy val MavenCompile = config("m2r") extend(Compile) //a configuration to set an alternative publishLocalConfiguration
lazy val publishLocalBoth = TaskKey[Unit]("pl", "publish local for m2 and ivy")
lazy val root = Project("hello", base = file(".")).
settings(
otherResolvers := Seq(Resolver.file("dotM2", file(Path.userHome + "/.m2/repository"))),
publishLocalConfiguration in MavenCompile <<= (packagedArtifacts, deliverLocal, ivyLoggingLevel) map {
(arts, _, level) => new PublishConfiguration(None, "dotM2", arts, Seq(), level)
},
publishMavenStyle in MavenCompile := true,
publishLocal in MavenCompile <<= publishTask(publishLocalConfiguration in MavenCompile, deliverLocal),
publishLocalBoth <<= Seq(publishLocal in MavenCompile, publishLocal).dependOn
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment