diff --git a/build.sbt b/build.sbt index f72038ecd..2cffb3cd8 100644 --- a/build.sbt +++ b/build.sbt @@ -468,8 +468,7 @@ def otherRootSettings = Seq( Scripted.scriptedPrescripted := { f => val inj = f / "project" / "maven.sbt" if (!inj.exists) { - IO.write(inj, """libraryDependencies += Defaults.sbtPluginExtra("org.scala-sbt" % "sbt-maven-resolver" % sbtVersion.value, - |sbtBinaryVersion.value, scalaBinaryVersion.value)""".stripMargin) + IO.write(inj, "addMavenResolverPlugin") // sLog.value.info(s"""Injected project/maven.sbt to $f""") } } diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 5c66c1c1c..7206c8673 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -1778,6 +1778,12 @@ trait BuildExtra extends BuildCommon with DefExtra { Seq(compose(onLoad, add), compose(onUnload, remove)) } + /** + * Adds Maven resolver plugin. + */ + def addMavenResolverPlugin: Setting[Seq[ModuleID]] = + libraryDependencies += sbtPluginExtra(ModuleID("org.scala-sbt", "sbt-maven-resolver", sbtVersion.value), sbtBinaryVersion.value, scalaBinaryVersion.value) + /** * Adds `dependency` as an sbt plugin for the specific sbt version `sbtVersion` and Scala version `scalaVersion`. * Typically, use the default values for these versions instead of specifying them explicitly. diff --git a/notes/0.13.8.markdown b/notes/0.13.8.markdown index daa0dcbcf..c85da9dd7 100644 --- a/notes/0.13.8.markdown +++ b/notes/0.13.8.markdown @@ -101,8 +101,7 @@ to resolve Maven dependencies instead of Apache Ivy. To enable this plugin, add the following to `project/maven.sbt` (or `project/plugin.sbt` the file name doesn't matter): - libraryDependencies += Defaults.sbtPluginExtra("org.scala-sbt" % "sbt-maven-resolver" % sbtVersion.value, - sbtBinaryVersion.value, scalaBinaryVersion.value) + addMavenResolverPlugin This will create a new `~/.ivy2/maven-cache` directory, which contains the Aether cache of files. You may notice some file will be re-downloaded for the new cache layout.