diff --git a/launch/src/main/input_resources/sbt/sbt.boot.properties b/launch/src/main/input_resources/sbt/sbt.boot.properties index 3bbd92970..9234be5f8 100644 --- a/launch/src/main/input_resources/sbt/sbt.boot.properties +++ b/launch/src/main/input_resources/sbt/sbt.boot.properties @@ -12,7 +12,6 @@ [repositories] local - jcenter: https://jcenter.bintray.com/ maven-central typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly sbt-ivy-snapshots: https://repo.scala-sbt.org/scalasbt/ivy-snapshots/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 2860c67d8..c29c31ad7 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -1148,6 +1148,7 @@ object Classpaths { moduleConfigurations :== Nil, publishTo :== None, resolvers :== Nil, + useJCenter :== false, retrievePattern :== Resolver.defaultRetrievePattern, transitiveClassifiers :== Seq(SourceClassifier, DocClassifier), sourceArtifactTypes :== Artifact.DefaultSourceTypes, @@ -1174,12 +1175,16 @@ object Classpaths { organizationHomepage <<= organizationHomepage or homepage, projectInfo <<= (name, description, homepage, startYear, licenses, organizationName, organizationHomepage, scmInfo, developers) apply ModuleInfo, overrideBuildResolvers <<= appConfiguration(isOverrideRepositories), - externalResolvers <<= (externalResolvers.task.?, resolvers, appResolvers) { - case (Some(delegated), Seq(), _) => delegated - case (_, rs, Some(ars)) => task { ars ++ rs } // TODO - Do we need to filter out duplicates? - case (_, rs, _) => task { Resolver.withDefaultResolvers(rs) } + externalResolvers <<= (externalResolvers.task.?, resolvers, appResolvers, useJCenter) { + case (Some(delegated), Seq(), _, _) => delegated + case (_, rs, Some(ars), uj) => task { ars ++ rs } + case (_, rs, _, uj) => task { Resolver.withDefaultResolvers(rs, uj, true) } + }, + appResolvers := { + val ac = appConfiguration.value + val uj = useJCenter.value + appRepositories(ac) map { ars => Resolver.reorganizeAppResolvers(ars, uj, true) } }, - appResolvers <<= appConfiguration apply appRepositories, bootResolvers <<= appConfiguration map bootRepositories, fullResolvers <<= (projectResolver, externalResolvers, sbtPlugin, sbtResolver, bootResolvers, overrideBuildResolvers) map { (proj, rs, isPlugin, sbtr, boot, overrideFlag) => boot match { diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index 5536feeca..86ef49416 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -345,6 +345,7 @@ object Keys { val projectResolver = TaskKey[Resolver]("project-resolver", "Resolver that handles inter-project dependencies.", DTask) val fullResolvers = TaskKey[Seq[Resolver]]("full-resolvers", "Combines the project resolver, default resolvers, and user-defined resolvers.", CTask) val otherResolvers = SettingKey[Seq[Resolver]]("other-resolvers", "Resolvers not included in the main resolver chain, such as those in module configurations.", CSetting) + val useJCenter = SettingKey[Boolean]("use-jcenter", "Use JCenter as the default repository.", BSetting) val moduleConfigurations = SettingKey[Seq[ModuleConfiguration]]("module-configurations", "Defines module configurations, which override resolvers on a per-module basis.", BMinusSetting) val retrievePattern = SettingKey[String]("retrieve-pattern", "Pattern used to retrieve managed dependencies to the current build.", DSetting) val retrieveConfiguration = SettingKey[Option[RetrieveConfiguration]]("retrieve-configuration", "Configures retrieving dependencies to the current build.", DSetting) diff --git a/notes/0.13.10/make-JCenter-opt-in.markdown b/notes/0.13.10/make-JCenter-opt-in.markdown new file mode 100644 index 000000000..6ca9bec03 --- /dev/null +++ b/notes/0.13.10/make-JCenter-opt-in.markdown @@ -0,0 +1,7 @@ + + [@eed3si9n]: https://github.com/eed3si9n + [2217]: https://github.com/sbt/sbt/issues/2217 + +### Fixes with compatibility implications + +- sbt 0.13.10 adds a new setting `useJCenter`, which is set to `false` by default. When set to `true`, JCenter will be placed as the first external resolver to find library dependencies. [#2217][2217] by [@eed3si9n][@eed3si9n] diff --git a/notes/0.13.9.markdown b/notes/0.13.9.markdown index dab3fcd0f..e82387097 100644 --- a/notes/0.13.9.markdown +++ b/notes/0.13.9.markdown @@ -51,12 +51,14 @@ [2046]: https://github.com/sbt/sbt/issues/2046 [2097]: https://github.com/sbt/sbt/pull/2097 [2129]: https://github.com/sbt/sbt/pull/2129 + [1938]: https://github.com/sbt/sbt/pull/1938 ### Fixes with compatibility implications - Starting 0.13.9, `crossScalaVersions` default value is fixed back to the older 0.12.x behavior. See below for details. - Starting 0.13.9, the generated POM files no longer include dependencies on source or javadoc jars obtained via `withSources()` or `withJavadoc()`. See below for details. - Scala version is bumped to 2.10.5. This brings in the fix for [SI-9027][SI9027]: XML node sequence literal bug. [#1666][1666]/[#2068][2068] by [@eed3si9n][@eed3si9n] +- Change launcher configuration so [JCenter](https://bintray.com/bintray/jcenter) is looked at first before all other external repositories. [#1938][1938] ### Improvements diff --git a/sbt/src/sbt-test/dependency-management/default-resolvers/build.sbt b/sbt/src/sbt-test/dependency-management/default-resolvers/build.sbt new file mode 100644 index 000000000..dfb7fbb1c --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/default-resolvers/build.sbt @@ -0,0 +1,16 @@ +lazy val check = taskKey[Unit]("") +lazy val check2 = taskKey[Unit]("") + +lazy val root = (project in file(".")). + settings( + check := { + val fr = fullResolvers.value + assert(!(fr exists { _.name == "jcenter" })) + assert(fr exists { _.name == "public" }) + }, + check2 := { + val fr = fullResolvers.value + assert(fr exists { _.name == "jcenter" }) + assert(fr exists { _.name == "public" }) + } + ) diff --git a/sbt/src/sbt-test/dependency-management/default-resolvers/test b/sbt/src/sbt-test/dependency-management/default-resolvers/test new file mode 100644 index 000000000..0d310c9f5 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/default-resolvers/test @@ -0,0 +1,11 @@ +> check + +> set useJCenter := true + +> check2 + +> reload + +> set resolvers += Resolver.jcenterRepo + +> check2 diff --git a/src/main/conscript/sbt/launchconfig b/src/main/conscript/sbt/launchconfig index 81d7bfd1b..033dc550b 100644 --- a/src/main/conscript/sbt/launchconfig +++ b/src/main/conscript/sbt/launchconfig @@ -12,7 +12,6 @@ [repositories] local - jcenter: https://jcenter.bintray.com/ maven-central typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly sbt-ivy-snapshots: https://repo.scala-sbt.org/scalasbt/ivy-snapshots/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly diff --git a/src/main/conscript/scalas/launchconfig b/src/main/conscript/scalas/launchconfig index ff63d0fa8..0d0d5664c 100644 --- a/src/main/conscript/scalas/launchconfig +++ b/src/main/conscript/scalas/launchconfig @@ -12,7 +12,6 @@ [repositories] local - jcenter: https://jcenter.bintray.com/ maven-central typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly sbt-ivy-snapshots: https://repo.scala-sbt.org/scalasbt/ivy-snapshots/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly diff --git a/src/main/conscript/screpl/launchconfig b/src/main/conscript/screpl/launchconfig index ffdf06ee8..afa5eb125 100644 --- a/src/main/conscript/screpl/launchconfig +++ b/src/main/conscript/screpl/launchconfig @@ -12,7 +12,6 @@ [repositories] local - jcenter: https://jcenter.bintray.com/ maven-central typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly sbt-ivy-snapshots: https://repo.scala-sbt.org/scalasbt/ivy-snapshots/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly