Tested PR for #485. Had a hard time squashing this, maybe because I did a merge in between. Sorry about that!

This commit is contained in:
Brian Topping 2014-09-15 10:48:47 -04:00
parent ef3eccf95f
commit ad7d9ce42b
1 changed files with 12 additions and 11 deletions

View File

@ -300,18 +300,19 @@ object Resolver {
def localBasePattern = "[organisation]/[module]/" + PluginPattern + "[revision]/[type]s/[artifact](-[classifier]).[ext]" def localBasePattern = "[organisation]/[module]/" + PluginPattern + "[revision]/[type]s/[artifact](-[classifier]).[ext]"
def defaultRetrievePattern = "[type]s/[organisation]/[module]/" + PluginPattern + "[artifact](-[revision])(-[classifier]).[ext]" def defaultRetrievePattern = "[type]s/[organisation]/[module]/" + PluginPattern + "[artifact](-[revision])(-[classifier]).[ext]"
final val PluginPattern = "(scala_[scalaVersion]/)(sbt_[sbtVersion]/)" final val PluginPattern = "(scala_[scalaVersion]/)(sbt_[sbtVersion]/)"
private[this] def mavenLocalDir: File = private[this] def mavenLocalDir: File = {
{ def loadHomeFromSettings(f: () => File): Option[File] =
val homeConfig = XML.loadFile(new File(Path.userHome, ".m2/settings.xml")) try {
homeConfig \ "settings" \ "localRepository" match { XML.loadFile(f()) \ "settings" \ "localRepository" match {
case scala.xml.Text(x) => new File(x) case scala.xml.Text(loc) => Some(new File(loc))
case _ => case _ => None
val globalConfig = XML.loadFile(new File(Path.fileProperty("M2_HOME"), "conf/settings.xml")) }
globalConfig \ "settings" \ "localRepository" match { } catch {
case scala.xml.Text(x) => new File(x) case _: Throwable => None
case _ => new File(Path.userHome, ".m2/repository/")
}
} }
loadHomeFromSettings(() => new File(Path.userHome, ".m2/settings.xml")) orElse
loadHomeFromSettings(() => new File(Path.fileProperty("M2_HOME"), "conf/settings.xml")) getOrElse
new File(Path.userHome, ".m2/repository")
} }
def publishMavenLocal = Resolver.file("publish-m2-local", mavenLocalDir) def publishMavenLocal = Resolver.file("publish-m2-local", mavenLocalDir)
def mavenLocal = MavenRepository("Maven2 Local", mavenLocalDir.toURI.toString) def mavenLocal = MavenRepository("Maven2 Local", mavenLocalDir.toURI.toString)