This is a simple-build-tool plugin for inserting/updating license headers in your source files. It was developed for ease of use and general laziness.
The sbt-license-plugin
is published over on our bintray repository.
Read more about plugins here and here.
formatLicenseHeaders
is a task that is called from the sbt console. In the default LicenseSettings
, it is part of the normal compile cycle.
-
To get the
formatLicenseHeaders
task that adds customizable header text, import the plugin's keys, and add theLicenseSettings
setting to your build definition. InvokingformatLicenseHeaders
will add the license to all of your main sources files. Optionally, you can remove any pre-existing header by setting theremoveExistingHeaderBlock
setting totrue
.i.e. in
build.sbt
:import com.banno.license.Plugin.LicenseKeys._ licenseSettings removeExistingHeaderBlock := true name := "example" version := "0.1" organization := "com.banno"
-
To add an
apache2
ormit
license with a custom copyright line, import the licenses as well and set thelicense
setting like so:i.e. in
build.sbt
:import com.banno.license.Plugin.LicenseKeys._ import com.banno.license.Licenses._ licenseSettings license := apache2("Copyright 2013") removeExistingHeaderBlock := true name := "example" version := "0.1" organization := "com.banno"
Ensure that things are working properly by testing the plugin with the scripted
task, however, note that the scripted-plugin only works with sbt launcher versions 0.12-0.12.3. Learn more about testing plugins here.
Fork away, commit, and send a pull request. Make sure that the tests pass before you submit your pull request.