Created
September 30, 2012 18:29
-
-
Save schleichardt/3808085 to your computer and use it in GitHub Desktop.
SBT: publish-local to both .m2 and .ivy2, answer for https://groups.google.com/forum/?fromgroups=#!searchin/simple-build-tool/m2/simple-build-tool/BLir3V_3ajY/YQZ5vobWatoJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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