Skip to content

sbt plugin for adding/updating license headers in source files

License

Notifications You must be signed in to change notification settings

ndwade/sbt-license-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sbt-license-plugin

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.

Installation

The sbt-license-plugin is published over on our bintray repository.

Read more about plugins here and here.

Usage

formatLicenseHeaders is a task that is called from the sbt console. In the default LicenseSettings, it is part of the normal compile cycle.

  1. To get the formatLicenseHeaders task that adds customizable header text, import the plugin's keys, and add the LicenseSettings setting to your build definition. Invoking formatLicenseHeaders will add the license to all of your main sources files. Optionally, you can remove any pre-existing header by setting the removeExistingHeaderBlock setting to true.

    i.e. in build.sbt:

      import com.banno.license.Plugin.LicenseKeys._
    
      licenseSettings
    
      removeExistingHeaderBlock := true
    
      name := "example"
    
      version := "0.1"
    
      organization := "com.banno"
    
  2. To add an apache2 or mit license with a custom copyright line, import the licenses as well and set the license 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"
    

Testing

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.

Contributing

Fork away, commit, and send a pull request. Make sure that the tests pass before you submit your pull request.

Copyright (C) Banno 2011-2014

About

sbt plugin for adding/updating license headers in source files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala 100.0%