Simpler build settings by using an auto-plugin to automatically add settings from sbt-utils.
In your project/plugins.sbt file:
resolvers += Resolver.url("hmrc-sbt-plugin-releases",
url("https://dl.bintray.com/hmrc/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "x.x.x")
where 'x.x.x' is the latest release as advertised above.
We have added the resolver here, if you already have the 'https://dl.bintray.com/hmrc/sbt-plugin-releases' repo added there's no need to re-add it here.
Add the line .enablePlugins(SbtAutoBuildPlugin)
to your project to enable the plugin.
When enabled sbt-auto-build automatically adds the most comonly used settings in sbt-utils which are the settings collections:
- scalaSettings
- SbtBuildInfo
- defaultSettings
- HeaderSettings
It also automatically adds sbt-utils and sbt-header plugins. SBT header is on by default and will generate licence headers in your source files. As a result you don't have to add licence headers to source files manually
To make the automatic addition of settings more visible you'll see output like this in your build:
[info] SbtAutoBuildPlugin adding 19 build settings:
[info] buildinfo, buildinfo, buildinfoBuildnumber, buildinfoKeys, buildinfoKeys, buildinfoObject, buildinfoPackage, buildinfoPackage, fork, headers, initialCommands, isSnapshot, organization, packageOptions, parallelExecution, scalaVersion, scalacOptions, sourceGenerators, testOptions
See and example of this on the time project: HmrcBuild.scala and plugins.sbt
- Remove references to sbt-utils and sbt-header form your project/plugins.sbt file and add the code listed in 'Usage' above
- Remove references to scalaSettings, SbtBuildInfo, defaultSettings and HeaderSettings in your project/HmrcBuild.scala file