knutwalker / sbt-knutwalker   0.6.0

GitHub
Scala versions: 2.12
sbt plugins: 1.0

sbt-knutwalker

An opinionated plugin for github-based open-source projects.

Introduction

sbt-knutwalker is a meta-plugin for sbt to simplify project builds with typical or recommended settings. It's based on the way I like to build my projects and if you agree with me there, you might benefit from this plugin, too.

What you get

As a meta-plugin, the following plugins are automatically included (alphabetical order)

  • sbt-assembly 0.14.6 Build fat-jars for your application

  • sbt-buildinfo 0.7.0 Generate code based on your build.sbt

  • sbt-docker 1.4.1 Generate docker images for your application

  • sbt-ghpages 0.6.2 Push documentation and static content to github pages

  • sbt-git 0.9.3 Versioning based on git

  • sbt-header 4.1.0 For creating and maintaining license headers

  • sbt-jmh 0.3.3 Trust no one, bench everything

  • sbt-mima-plugin 0.1.18 Check for binary compability

  • sbt-pgp 1.1.0 For signing artifacts when publishing to sonatype

  • sbt-release 1.0.7 Provides a customizable workflow for releases

  • sbt-revolver 0.9.1 quickly restart your application

  • sbt-sonatype 2.1 Provides support for Sonatype

  • sbt-scoverage 1.5.1 For running statement and branch coverage

  • sbt-site 1.3.1 Generate static content for documentation (and github pages)

  • tut-plugin 0.6.2 Compile and check your documentation

  • sbt-unidoc 0.4.1 Generate unified documentation across multiple projects

Not all of these are configured (e.g. docker), they're just included so you don't have to add them to the plugins.sbt. Also, some of those are targeted at libraries while others are targeted at applications. Future versions might make a distinction there.

Further, these things are provided or simplified

Installation

sbt 0.13

Add the folling to you project/plugins.sbt

addSbtPlugin("de.knutwalker" % "sbt-knutwalker" % "0.5.1")

sbt 1.0

Add the folling to you project/plugins.sbt

addSbtPlugin("de.knutwalker" % "sbt-knutwalker" % "0.6.0")

Usage

The following keys should be used to activate various features and simplicifications

maintainer

maintainer := "Me Dev"

Maintainer is used mainly for the license header as the licenser to use (Copyright YYYY $maintainer)

It is also used as the name for the developer in the generated pom for sonatype releasing

githubProject

githubProject := de.knutwalker.sbt.Github("myorg", "awesome-project")

Setting githubProject:

  • sets the organizationHomepage to the github user site
  • sets the homepage to the github repository site
  • fills the scm-info in the generated pom for sonatype releasing
  • sets the id and url for the developer in the generated pom for sonatype releasing
githubDevs

A list of developers that will be included in the generated pom for sonatype releasing. It also workarounds a bug in pom generation in sbt 0.13.8

javaVersion

javaVersion controls the scalac flag target, based on the used version and the different target support for of different scala versions.

other keys

There are several other keys that are not yet implemented correctly or sufficently to be mentioned here.

Example

The following is a minimal build.sbt definition that includes license headers and enables publishing to Sonatype nexus.

         name := "aweseome-project"
   maintainer := "Foo Bar"
 scalaVersion := "2.11.8"
 organization := "org.example"
githubProject := Github("example", "awesome-project")