sbt 0.13.5+ releases of sbt are technology previews of what’s to come to sbt 1.0 with enhancements like auto plugins, launcher enhacements for sbt server, defined in the sbt-remote-control project, and other necessary API changes.
These releases maintain binary compatibility with plugins that are published against sbt 0.13.0, but add new features in preparation for sbt 1.0. The tech previews allow us to test new ideas like auto plugins and performance improvements on dependency resolution; the build users can try new features without losing the existing plugin resources; and plugin authors can gradually migrate to the new plugin system before sbt 1.0 arrives.
clean concurrency fix. #2156/#3834 by @dwijnand
scala.ext.dir. #3142/#3701 by @retronym
addSbtPlugin to use the correct version of sbt. #3393/#3397 by @dwijnand
addCompilerPlugin(...) so it can consume compiler plugins published to Ivy repository using sbt 1.x. #3784/#3855 by @eed3si9n
sbt xxx shell to stay in shell after xxx. #3091/#3153 by @dwijnand
^ and ^^ commands for plugin cross building. See below.
Zero scope component for sbt 1.0 compatibility. #3179 by @eed3si9n
withXXX methods for ModuleID and Artifact for sbt 1.0 compatibility. #3215 by @eed3si9n
scalaBinaryVersion for Dotty. #3152 by [@smarter][@smater]
NumberFormatException. #3265 by @Rogach
@jrudolph’s sbt-cross-building is a plugin author’s plugin.
It adds cross command ^ and sbtVersion switch command ^^, similar to + and ++,
but for switching between multiple sbt versions across major versions.
sbt 0.13.16 merges these commands into sbt because the feature it provides is useful as we migrate plugins to sbt 1.0.
To switch the sbtVersion in pluginCrossBuild from the shell use:
^^ 1.0.0-RC2
Your plugin will now build with sbt 1.0.0-RC2 (and its Scala version 2.12.2).
If you need to make changes specific to a sbt version, you can now include them into src/main/scala-sbt-0.13,
and src/main/scala-sbt-1.0, where the binary sbt version number is used as postfix.
To run a command across multiple sbt versions, set:
crossSbtVersions := Vector("0.13.15", "1.0.0-RC2")
Then, run:
^ compile
sbt 0.13.16 improves the eviction warning presetation.
Before:
[warn] There may be incompatibilities among your library dependencies.
[warn] Here are some of the libraries that were evicted:
[warn] * com.google.code.findbugs:jsr305:2.0.1 -> 3.0.0
[warn] Run 'evicted' to see detailed eviction warnings
After:
[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn]
[warn] * com.typesafe.akka:akka-actor_2.12:2.5.0 is selected over 2.4.17
[warn] +- de.heikoseeberger:akka-log4j_2.12:1.4.0 (depends on 2.5.0)
[warn] +- com.typesafe.akka:akka-parsing_2.12:10.0.6 (depends on 2.4.17)
[warn] +- com.typesafe.akka:akka-stream_2.12:2.4.17 () (depends on 2.4.17)
[warn]
[warn] Run 'evicted' to see detailed eviction warnings
sbt writes out the sbt.version in project/build.properties if it is missing.
sbt 0.13.16 fixes the logging when it happens by using the logger.
We encourage the use of the sbt shell by running sbt, instead of running sbt compile from the terminal repreatedly.
The sbt shell keeps the JVM warm, and there is a significant performance improvement gained for your compilation.
The startup message that we added in sbt 0.13.15 was a bit too aggressive, so we are toning it down in 0.13.16.
It will only be triggered for sbt compile, and it can also be supressed with suppressSbtShellNotification := true.
#3091/#3097/#3147 by @dwijnand
[ENTER] while sbt is running. #2987/#2996 by @dwijnand
Append instance to support sourceGenerators += Def.task { ... }, instead of needing .taskValue. #2943 by @eed3si9n
project/build.properties if it is missing. #754/#3025 by @dwijnand
scalaCompilerBridgeSource correctly, this reduces the boilerplate needed
to make a dotty project. Note that dotty support in sbt is still considered
experimental and not officially supported, see dotty.epfl.ch for
more information. #2902 by @smarter
`
scripted source-dependencies/*1of3
`
Will create three pages and run page 1. This is especially useful when running
scripted tests on a CI, to benefit from the available parallelism. 3013 by @smarter
:= and .value macros. #1444/#2908 by @dwijnand
Compile. #2827/#2786 by @eed3si9n
Compile. #2828/#1466 by @eed3si9n
Package.makeJar deleting directory recursively. #3014 by @larsrh
Previously, when the dependency resolver (Ivy) encountered a Maven version range such as [1.3.0,)
it would go out to the Internet to find the latest version.
This would result to a surprising behavior where the eventual version keeps changing over time
even when there’s a version of the library that satisfies the range condition.
Starting sbt 0.13.15, some Maven version ranges would be replaced with its lower bound
so that when a satisfactory version is found in the dependency graph it will be used.
You can disable this behavior using the JVM flag -Dsbt.modversionrange=false.
sbt 0.13.15 adds two new repositories called “local-preloaded-ivy”
and “local-preloaded” that point to ~/.sbt/preloaded/.
The purpose for the repositories is to preload them with
sbt artifacts so the installation of sbt will not require access to the Internet.
This also improves the startup time of sbt when you first run it since the resolution happens off of a local-preloaded repository.
No changes should be necessary to your project definition and all plugins published for sbt 0.13.{x|x<14} should still work.
See Migrating from sbt 0.12.x for details on the old operator deprecation.
Special thanks to the contributors for making this release a success. According to git shortlog -sn --no-merges v0.13.13..0.13.15, compared to 0.13.13, there were 64 (non-merge) commits, by eleven contributors: Eugene Yokota, Dale Wijnand, Guillaume Martres, Jason Zaugg, Lars Hupel, Petro Verkhogliad, Eric Richardson, Claudio Bley, Haochi Chen, Paul Draper, Ashley Mercer. Thank you!
sbt 0.13.14 did not happen due a bug that was found after the artifact was published.
.value method is deprecated for input tasks. Calling .value on an input key returns an InputTask[A],
which is completely unintuitive and often results in a bug. In most cases .evaluated should be called,
which returns A by evaluating the task.
Just in case InputTask[A] is needed, .inputTaskValue method is now provided. #2709 by @eed3si9n
--<command> that was added in 0.13.1 to early(<command>). This fixes the regression #1041. For backward compatibility --error, --warn, --info, and --debug will continue to function during the 0.13 series, but it is strongly encouraged to migrate to the single hyphen options: -error, -warn, -info, and -debug. #2742 by @eed3si9n
show when key returns a Seq by showing the elements one per line. Disable with -Dsbt.disable.show.seq=true. #2755 by @eed3si9n
-Dsbt.disable.interface.classloader.cache=true. #2754 by @retronym
new command and templateResolverInfos. See below for more details.
aggregateProjects(..) for the current project inside a build sbt file. #2682 by @xuwei-k
.jvmopts support to the launcher script. sbt/sbt-launcher-package#111 by @fommil
.java-version support to the Windows launcher script. sbt/sbt-launcher-package#111 by @fommil
-error in script mode using scalas. #840/#2746 by @eed3si9n
CrossVersion.patch which sits in between CrossVersion.binary and CrossVersion.full in that it strips off any
trailing -bin-... suffix which is used to distinguish variant but binary compatible Scala toolchain builds. Most things
which are currently CrossVersion.full (eg. Scala compiler plugins, esp. macro-paradise) would be more appropriately
depended on as CrossVersion.patch from this release on.
scalaOrganization is set. #2703 by @milessabin
Tags.ForkedTestGroup. #2677/#2681 by @pauldraper
sbt 0.13.13 adds a new command, which helps create new build definitions.
The new command is extensible via a mechanism called the template resolver.
A template resolver pattern matches on the passed in arguments after new,
and if it’s a match it will apply the template.
As a reference implementation, template resolver for Giter8 is provided. For instance:
sbt new eed3si9n/hello.g8
will run eed3si9n/hello.g8 using Giter8.
sbt 0.13.13 adds support for AutoPlugins to define subprojects programmatically,
by overriding the extraProjects method:
import sbt._, Keys._
object ExtraProjectsPlugin extends AutoPlugin {
override def extraProjects: Seq[Project] =
List("foo", "bar", "baz") map generateProject
def generateProject(id: String): Project =
Project(id, file(id))
.settings(
name := id
)
}
In addition, subprojects may be derived from an existing subproject
by overriding derivedProjects:
import sbt._, Keys._
object DerivedProjectsPlugin extends AutoPlugin {
// Enable this plugin by default
override def requires: Plugins = sbt.plugins.CorePlugin
override def trigger = allRequirements
override def derivedProjects(proj: ProjectDefinition[_]): Seq[Project] =
// Make sure to exclude project extras to avoid recursive generation
if (proj.projectOrigin != ProjectOrigin.DerivedProject) {
val id = proj.id + "1"
Seq(
Project(id, file(id))
.enablePlugins(DatabasePlugin)
)
}
else Nil
}
#2532/#2717/#2738 by @eed3si9n
The no-longer-documented operators <<=, <+=, and <++= and tuple enrichments are deprecated,
and will be removed in sbt 1.0.
Generally,
task3 <<= (task1, task2) map { (t1, t2) => println(t1 + t2); t1 + t2 }
should migrate to
task3 := {
println(task1.value + task2.value)
task1.value + task2.value
}
Except for source generators, which requires task values:
sourceGenerators in Compile <+= buildInfo
This becomes:
sourceGenerators in Compile += buildInfo.taskValue
Another exception is input task:
run <<= docsRunSetting
This becomes:
run := docsRunSetting.evaluated
See Migrating from sbt 0.12.x for more details.
#2716/#2763/#2764 by @eed3si9n and @dwijnand
scalaVersion and
scalaOrganization. Previously a user specified scalaOrganization would not have affected transitive
dependencies on, eg. scala-reflect. An Ivy-level mechanism is used for this purpose, and as a consequence
the overriding happens early in the resolution process which might improve resolution times, and as a side
benefit fixes #2286. The old behavior can be restored by adding
ivyScala := { ivyScala.value map {_.copy(overrideScalaVersion = sbtPlugin.value)} }
to your build. #2286/#2634 by @milessabin
.sbt format #2530 by @dwijnand
RecompileOnMacroDef is enabled, sbt will now print out a info level log indicating that some sources are being recompiled because it’s used from a source that contains a macro definition. Can be disabled with incOptions := incOptions.value.withLogRecompileOnMacro(false) #2637/#2659 by @eed3si9n/@dwijnand
dependsOn for the current project inside a .sbt file. #2653 by @anatolydwnld
IndexOutOfBoundsException in ExtractAPI #2497/#2557 by @smarter
incOptions := incOptions.value.withIncludeSynthToNameHashing(true) for name hashing not including synthetic methods. This will not be enabled by default in sbt 0.13. It can also enabled by passing sbt.inc.include_synth=true to JVM. #2537 by @eed3si9n
useJCenter can be set to true to re-include it, as the first external resolver to find library dependencies. #2217/#2467 by @eed3si9n
withInterProjectFirst to the update option, which is enabled by default. When set to true, inter-project resolver will be prioritized above all resolvers and Ivy cache. #1827 by @eed3si9n
withLatestSnapshots so it handles modules without an artifact. This flag will be enabled by default.
#1514/#1616/#2313 by @eed3si9n
-J<flag> options to the local Java compiler. #1968/#2272 by @Duhemm
sbt.global.autoimport flag is true. #2120/#2399 by @timcharper
publishMavenStyle is true, update task warns when it sees intransitive dependencies, which do not translate to Maven. #2127 by @jsuereth
Def.settings, which facilitates mixing settings with seq of settings. See below.
Logger.Null public. #2094 by @pdalpra
Append.Sequence instance for List to allow +=/++= on developers setting. #2107/#2114 by @pdalpra
sealed from the typeclasses in Append. #2322 by @dwijnand
localIfFile to MavenRepository, to force artifacts to be copied to the cache. #2172 by @dwijnand
Resolver.bintrayIvyRepo(owner, repo). #2285 by @dwijnand
-J options. sbt/sbt-launcher-package#105
sbt.Execute. #2302/#2303 by @jrudolph
updateClassifiers downloading updated snapshot sources and docs.
#1750/sbt/ivy#17/#2163/sbt/ivy#18/#2186 by @dwijnand
updateClassifiers on Ivy modules without default configuration.
#2264 by @eed3si9n/@Duhemm
ListBuffer#readOnly. #2095 by @adriaanm
tasks and settings command. #2192 by @DavidPerezIngeniero
javac by always failing if the local Java compiler reported errors. #2228/#2271 by @Duhemm
JavaErrorParser to parse non-compile-errors #2256/#2272 by @Duhemm
sbt-ivy-snapshots repository to resolve nightly builds. @eed3si9n
compileLate. #2453 by @retronym
SBT_OPTS. sbt/sbt-launcher-package#101 by @eed3si9n
sbt 0.13.11 adds scalaCompilerBridgeSource setting to specify the compiler brigde source. This allows different implementation of the bridge for Scala versions, and also allows future versions of Scala compiler implementation to diverge. The source module will be retrieved using library management configured by bootIvyConfiguration task.
sbt 0.13.11 will assume that Dotty is used when scalaVersion starts with 0..
The built-in compiler bridge in sbt does not support Dotty,
but a separate compiler bridge is being developed at smarter/dotty-bridge and
an example project that uses it is available at smarter/dotty-example-project.
sbt 0.13.11 adds trackInternalDependencies and exportToInternal settings. These can be used to control whether to trigger compilation of a dependent subprojects when you call compile. Both keys will take one of three values: TrackLevel.NoTracking, TrackLevel.TrackIfMissing, and TrackLevel.TrackAlways. By default they are both set to TrackLevel.TrackAlways.
When trackInternalDependencies is set to TrackLevel.TrackIfMissing, sbt will no longer try to compile internal (inter-project) dependencies automatically, unless there are no *.class files (or JAR file when exportJars is true) in the output directory. When the setting is set to TrackLevel.NoTracking, the compilation of internal dependencies will be skipped. Note that the classpath will still be appended, and dependency graph will still show them as dependencies. The motivation is to save the I/O overhead of checking for the changes on a build with many subprojects during development. Here’s how to set all subprojects to TrackIfMissing.
lazy val root = (project in file(".")).
aggregate(....).
settings(
inThisBuild(Seq(
trackInternalDependencies := TrackLevel.TrackIfMissing,
exportJars := true
))
)
The exportToInternal setting allows the dependee subprojects to opt out of the internal tracking, which might be useful if you want to track most subprojects except for a few. The intersection of the trackInternalDependencies and exportToInternal settings will be used to determine the actual track level. Here’s an example to opt-out one project:
lazy val dontTrackMe = (project in file("dontTrackMe")).
settings(
exportToInternal := TrackLevel.NoTracking
)
Using Def.settings it is now possible to nicely define settings as such:
val modelSettings = Def.settings(
sharedSettings,
libraryDependencies += foo
)
sbt 0.13.10 did not happen due a bug that was found after the artifact was published.
crossScalaVersions default value is fixed back to the older 0.12.x behavior. See below for details.
withSources() or withJavadoc(). See below for details.
retrieveManaged related improvements. See below for details.
-= and --= for settings and tasks, which are the opposites of += and ++=. #1922 by @dwijnand
inThisBuild, similar to inConfig, to allow specifying multiple settings in ThisBuild scope. #1847/#1989 by @dwijnand
forceUpdatePeriod key, that takes values of Option[FiniteDuration]. If set, a full update will occur after that amount of time without needing to explicitly run the update task. By @ajsquared
ForkError.getMessage() to include exception’s original name. #2028 by @kamilkloch
inspect actual. #1651/#1990 by @dwijnand
testOnly/testQuick with -, for example -MySpec.
#1970 by @matthewfarwell
Extracted.runInputTask helper to assist with imperatively executing input tasks. #2006 by @jroper
distinct method on PathFinder to distinctName. #1973 by @eed3si9n
distinctPath method on PathFinder. #1973 by @eed3si9n
maven-metadata.xml. See below.
help command. #1900/#1940 by @DavidPerezIngeniero
crossScalaVersions default value As of this fix crossScalaVersions returns to the behaviour present in 0.12.4 whereby it defaults to what
scalaVersion is set to, for example if scalaVersion is set to "2.11.6", crossScalaVersions now defaults
to Seq("2.11.6").
Therefore when upgrading from any version between 0.13.0 and 0.13.8 be aware of this new default if
your build setup depended on it.
When declaring library dependencies using the withSources() or withJavadoc() options, sbt was also including in the pom file, as dependencies, the source or javadoc jars using the default Maven scope. Such dependencies might be erroneously processed as they were regular jars by automated tools
retrieveManaged related improvements sbt 0.13.9 adds retrieveManagedSync key that, when set to true, enables synchronizing retrieved to the current build by removed unneeded files.
It also adds configurationsToRetrieve key, that takes values of Option[Set[Configuration]]. If set, when retrieveManaged is true only artifacts in the specified configurations will be retrieved to the current build.
#1950/#1987 by @ajsquared
On a larger dependency graph, the JSON file growing to be 100MB+ with 97% of taken up by caller information. To make the matter worse, these large JSON files were never cleaned up.
sbt 0.13.9 filters out artificial or duplicate callers,
which fixes OutOfMemoryException seen on some builds.
This generally shrinks the size of JSON, so it should make the IO operations faster.
Dynamic graphs will be rotated with directories named after yyyy-mm-dd,
and stale JSON files will be cleaned up after few days.
sbt 0.13.9 also fixes a correctness issue that was found in the earlier releases.
Under some circumstances, libraries that shouldn’t have been evicted was being evicted.
This occured when library A1 depended on B2, but a newer A2 dropped the dependency,
and A2 and B1 are also is in the graph. This is fixed by sorting the graph prior to eviction.
#2030/#1721/#2014/#2046/#2097 by @eed3si9n
@cunei in #1223 discovered that sbt leaks PermGen
when it creates classloaders to call Scala Compilers.
sbt 0.13.9 will call GC on a set interval (default: 60s).
It will also call GC right before cross building.
This behavior can diabled using by setting false to forcegc
setting or sbt.task.forcegc flag.
To resolve dynamic versions such as SNAPSHOT and version ranges, the dependency resolution engine
queries for the list of available versions.
For Maven repositories, it was supposed read maven-metadata.xml first, but
because sbt customizes the repository layout for cross building, it has been falling back
to screen scraping of the Apache directory listing.
This problem surfaced as:
SNAPSHOT related issues.
sbt 0.13.9 fixes this by relaxing the Maven compatiblity check, so it will read maven-metadata.xml. #2075 by @eed3si9n
IvyPlugin by default (-Dsbt.root.ivyplugin=true will revert this behavior). #1871/#1869 by @dwijnand
evicted will display all evictions (including the ones not suspected of binary incompatibility). #1615 by @eed3si9n
--depth 1 for git clone. #1787 by @xuwei-k
compilerReporter is fed to javac during incremental compilation. #1542 by @jsuereth
sbt 0.13.7 implemented natural whitespace handling by switching build.sbt parsing to use Scala compiler, instead of blank line delimiting. We realized that some build definitions no longer parsed due to the difference in XML handling.
val a = <x/><y/>
val b = 0
At the time, we thought adding parentheses around XML nodes could work around this behavior. However, the workaround has caused more issues, and since then we have realized that this is a compiler issue SI-9027, so we have decided to roll back our workaround. In the meantime, if you have consecutive XML elements in your build.sbt, enclose them in <xml:group> tag, or parentheses.
val a = <xml:group><x/><y/></xml:group>
val b = 0
When crossPaths setting is set to true (it is true by default), sbt 0.13.8 will include
src/main/scala-<scalaBinaryVersion>/ to the Compile compilation in addition to
src/main/scala. For example, it will include src/main/scala-2.11/ for Scala 2.11.5, and
src/main/scala-2.9.3 for Scala 2.9.3. #1799 by @indrajitr
sbt 0.13.8 adds an extension point in the dependency resolution to customize Maven resolvers. This allows us to write sbt-maven-resolver auto plugin, which internally uses Eclipse Aether 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):
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.
Additionally, sbt will now be able to fully construct
maven-metadata.xml files when publishing to remote repositories or when publishing to the local ~/.m2/repository.
This should help erase many of the deficiencies encountered when using Maven and sbt together.
Notes and known limitations:
sbt 0.13.8 adds experimental project-level dependency exclusions:
excludeDependencies += "org.apache.logging.log4j"
excludeDependencies += "com.example" %% "foo"
In the first example, all artifacts from the organization "org.apache.logging.log4j" are excluded from the managed dependency.
In the second example, artifacts with the organization "com.example" and the name "foo" cross versioned to the current scalaVersion are excluded.
Note: This feature currently does not translate to pom.xml!
sbt 0.13.8 adds a new Def.sequential function to run tasks under semi-sequential semantics.
Here’s an example usage:
lazy val root = project.
settings(
testFile := target.value / "test.txt",
sideEffect0 := {
val t = testFile.value
IO.append(t, "0")
t
},
sideEffect1 := {
val t = testFile.value
IO.append(t, "1")
t
},
foo := Def.sequential(compile in Compile, sideEffect0, sideEffect1, test in Test).value
)
Normally sbt’s task engine will reorder tasks based on the dependencies among the tasks,
and run as many tasks in parallel (See Custom settings and tasks for more details on this).
Def.sequential instead tries to run the tasks in the specified order.
However, the task engine will still deduplicate tasks. For instance, when foo is executed, it will only compile once,
even though test in Test depends on compile. #1817/#1001 by @eed3si9n
Now a Seq[Setting[_]] can be passed to Project.settings without the needs for “varargs expansion”, ie. : _*
Instead of:
lazy val foo = project settings (sharedSettings: _*)
It is now possible to do:
lazy val foo = project settings sharedSettings
Also, Seq[Setting[_]] can be declared at the same level as individual settings in Project.settings, for instance:
lazy val foo = project settings (
sharedSettings,
version := "1.0",
someMoreSettings
)
sbt 0.13.8 adds an extension point whereby users can effectively manipulate java bytecode (.class files) before the incremental compiler attempts to cache the classfile hashes. This allows libraries like ebean to function with sbt without corrupting the compiler cache and rerunning compile every few seconds.
This splits the compile task into several subTasks:
previousCompile: This task returns the previously persisted Analysis object for this project.
compileIncremental: This is the core logic of compiling Scala/Java files together. This task actually does the
work of compiling a project incrementally, including ensuring a minimum number of source files are compiled.
After this method, all .class files that would be generated by scalac + javac will be available.
manipulateByteCode: This is a stub task which takes the compileIncremental result and returns it.
Plugins which need to manipulate bytecode are expected to override this task with their own implementation, ensuring
to call the previous behavior.
compile: This task depends on manipulateBytecode and then persists the Analysis object containing all
incremental compiler information.
Here’s an example of how to hook the new manipulateBytecode key in your own plugin:
manipulateBytecode in Compile := {
val previous = (manipulateBytecode in Compile).value
doManipulateBytecode(previous) // Note: This must return a new Compiler.CompileResult with our changes.
}
See #1714 for the full details of the implementation.
Compile rather than every configuration if no master configuration is found. #1586 by @jsuereth
Here are examples:
val x, y = project // BAD
val x = project //
val y = project // GOOD
~/.sbt/repositories. #1579 by @copumpkin
file URLs. #1618 by @jsuereth
TextAnalysisFormat. #1572 by @Duhemm
developers key. #1590 by @jedesah
scalaHome/scalaInstance and running tests. #1584 by @jsuereth
set every. #1591/#1430 by @cunei
HttpClient resolver when httpclient is on the classpath. #1602 by @jsuereth
maven-metadata.xml file (common given the divergence in
Maven 3 and Ivy 2), we attempt to use LastModified timestamp in lieu of “published” timestamp.
#1611/#1618 by @jsuereth
ChainResolver and Maven repositories. #1611/#1618 by @jsuereth
Resolver’s url method dropping descriptorOptional and skipConsistencyCheck. #1621 by @tmandke
useLatestSnapshot on updateOptions to default to false. Reverts chain resolver to previous behavior. #1683 by @jsuereth
Starting sbt 0.13.7, build.sbt will be parsed using a customized Scala parser. This eliminates the requirement to use blank line as the delimiter between each settings, and also allows blank lines to be inserted at arbitrary position within a block.
This feature can be disabled, if necessary, via the -Dsbt.parser.simple=true flag.
This feature was contributed by Andrzej Jozwik (@ajozwik), Rafał Krzewski (@rkrzewski) and others at @WarsawScala inspired by Typesafe’s @gkossakowski organizing multiple meetups and hackathons on how to patch sbt with the focus on this blank line issue. Dziękujemy! #1606
Maven local repository is now resolved from the first of:
<localRepository/> element in ~/.m2/settings.xml
<localRepository/> element in $M2_HOME/conf/settings.xml, or
~/.m2/repository if neither of those configuration elements exist
If more Maven settings are required to be recovered, the proper thing to do is merge the two possible settings.xml files, then query against the element path of the merge. This code avoids the merge by checking sequentially.
By default circular dependencies are warned, but they do not halt the dependency resolution. Using the following setting, circular dependencies can be treated as an error.
updateOptions := updateOptions.value.withCircularDependencyLevel(CircularDependencyLevel.Error)
sbt 0.13.7 adds a new experimental update option called cached resolution, which replaces consolidated resolution:
updateOptions := updateOptions.value.withCachedResolution(true)
Unlike consolidated resolution, which only consolidated subprojects with identical dependency graph, cached resolution create an artificial graph for each direct dependency (minigraph) for all subprojects, resolves them independently, saves them into json file, and stiches the minigraphs together.
Once the minigraphs are resolved and saved as files, dependency resolution turns into a matter of loading json file from the second run onwards, which should complete in a matter of seconds even for large projects. Also, because the files are saved under a global ~/.sbt/0.13/dependency (or what’s specified by sbt.dependency.base flag), the resolution result is shared across all builds.
Breaking graphs into minigraphs allows partial resolution results to be shared, which scales better for subprojects with similar but slightly different dependencies, and also for making small changes to the dependencies graph over time. See documentation on cached resolution for more details.
ThisProject used to resolve to the root project in a build even when it’s place in subproj/build.sbt. sbt 0.13.6 fixes it to resolve to the sub project. #1194/#1358 by @dansanduleac
newer command in scripted. #1419 by @jroper
inc.Analysis.empty also defaults to the one compatible with name hashing. #1546 by @gkossakowski
projectDependencies. #1366/#1367 by @dansanduleac
build.sbt to be used from sbt shell. #1059/#1456
Resolver.jcenterRepo and Resolver.bintrayRepo(owner, repo) to add Bintray easier. #1405 by @evgeny-goldin
plugin command. #1416/#1426 by @lpiepiora
scala-jar to the list of jar artifacts recognized by CustomPomParser. #1400 by @dpratt
-Xfatal-warnings. #1477 by @puffnfresh
set comamnd #1486 @jsuereth
++ scala version setting. #856/#1489 by @jsuereth
Scope.parseScopedKey. #1384 by @eed3si9n
build.sbt errors causing ArrayIndexOutOfBoundsException due to invalid source in position. #1181 by @eed3si9n
http.proxyPassword showing up in launcher’s update.log. #670 by @eed3si9n
1.1+. #1275 by @eed3si9n
NullPointerError in tab completion by FileExamples. #1530 by @eed3si9n
Thanks to Sonatype, HTTPS access to Maven Central Repository is available to public. This is now enabled by default, but if HTTP is required for some reason the following system properties can be used:
-Dsbt.repository.secure=false
Java.net Maven 2 repository, Typesafe repository, and sbt Plugin repository also defaults to HTTPS.
#1494 by @rtyley, #1536 by @benmccann, and #1541 by @eed3si9n.
sbt 0.13.6 now allows enablePlugins and disablePlugins to be written directly in build.sbt. #1213/#1312 by @jsuereth
sbt 0.13.6 will try to reconstruct dependencies tree when it fails to resolve a managed dependency. This is an approximation, but it should help you figure out where the problematic dependency is coming from. When possible sbt will display the source position next to the modules:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: foundrylogic.vpp#vpp;2.2.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] foundrylogic.vpp:vpp:2.2.1
[warn] +- org.apache.cayenne:cayenne-tools:3.0.2
[warn] +- org.apache.cayenne.plugins:maven-cayenne-plugin:3.0.2 (/foo/some-test/build.sbt#L28)
[warn] +- d:d_2.10:0.1-SNAPSHOT
sbt 0.13.6 displays eviction warnings when it resolves your project’s managed dependencies via update task.
Currently the eviction warnings are categorized into three layers: scalaVersion eviction, direct evictions, and transitive evictions.
By default eviction warning on update task will display only scalaVersion evictin and direct evictions.
scalaVersion eviction warns you when scalaVersion is no longer effecitive. This happens when one of your dependency depends on a newer release of scala-library than your scalaVersion.
Direct evctions are evictions related to your direct dependencies. Warnings are displayed only when API incompatibility is suspected. For Java libraries, Semantic Versioning is used for guessing, and for Scala libraries Second Segment versioning (second segment bump makes API incompatible) is used.
To display all eviction warnings with caller information, run evicted task.
[warn] There may be incompatibilities among your library dependencies.
[warn] Here are some of the libraries that were evicted:
[warn] * com.typesafe.akka:akka-actor_2.10:2.1.4 -> 2.3.4 (caller: com.typesafe.akka:akka-remote_2.10:2.3.4,
org.w3:banana-sesame_2.10:0.4, org.w3:banana-rdf_2.10:0.4)
sbt 0.13.6 adds a new setting key called updateOptions for customizing the details of managed dependency resolution with update task. One of its flags is called lastestSnapshots, which controls the behavior of the chained resolver. Up until 0.13.6, sbt was picking the first -SNAPSHOT revision it found along the chain. When latestSnapshots is enabled (default: true), it will look into all resolvers on the chain, and compare them using the publish date.
The tradeoff is probably a longer resolution time if you have many remote repositories on the build or you live away from the severs. So here’s how to disable it:
updateOptions := updateOptions.value.withLatestSnapshots(false)
updateOptions can also be used to enable consolidated resolution for update task.
updateOptions := updateOptions.value.withConsolidatedResolution(true)
This feature is specifically targeted to address Ivy resolution is beging slow for multi-module projects #413. Consolidated resolution aims to fix this issue by artificially constructing an Ivy dependency graph for the unique managed dependencies. If two subprojects introduce identical external dependencies, both subprojects should consolidate to the same graph, and therefore resolve immediately for the second update. #1454 by @eed3si9n
sbt 0.13.5 is a technology preview of what’s to come to sbt 1.0 with enhancements like auto plugins and the necessary APIs changes and launcher for “sbt as a server.”, defined in the sbt-remote-control project.
sbt.Plugin deprecated in favor of sbt.AutoPlugin
testResultLogger is now configured.
JUnitXmlReportPlugin which generates junit-xml-reports for all tests.
-Dsbt.task.forcegc=true).