philippus / sbt-banner   0.0.1

Mozilla Public License 2.0 GitHub

🚩 Generate a Spring Boot-like banner.txt in your resources directory

Scala versions: 3.x 2.12
sbt plugins: 2.0.0-M3 1.x

sbt-banner

build Current Version Scala Steward badge license

Inspired by the banner in Spring Boot, sbt-banner can generate a banner in the resources directory on compile, or with the bannerGenerate command. You can, for example add this banner to the log at the start of your application with something like this:

Using.resource(Source.fromResource("banner.txt")) { source =>
  logger.info(source.getLines().mkString("\n"))
}

Installation

sbt-banner is published for sbt 1.10.7 and above. To start using it add the following to your plugins.sbt:

addSbtPlugin("nl.gn0s1s" % "sbt-banner" % "0.0.1")

Usage

Tasks

Task Description Command
bannerGenerate Generates a banner. $ sbt bannerGenerate

Configuration

You can configure the configuration in your build.sbt file.

Setting Description Default Value
bannerText The banner text placeholder
bannerCaption The banner caption None
bannerOverwrite Enable overwriting the banner file false

Example

bannerText := "sbt-banner"
bannerCaption := Some("Powered by 🍌Banana")
scala> scala.util.Using.resource(scala.io.Source.fromResource("banner.txt")) { source => println(source.getLines().mkString("\n"))}
       _     _        _                                 
   ___| |__ | |_     | |__   __ _ _ __  _ __   ___ _ __ 
  / __| '_ \| __|____| '_ \ / _` | '_ \| '_ \ / _ \ '__|
  \__ \ |_) | ||_____| |_) | (_| | | | | | | |  __/ |   
  |___/_.__/ \__|    |_.__/ \__,_|_| |_|_| |_|\___|_|   
                                                        
 Powered by 🍌Banana

Resources

License

The code is available under the Mozilla Public License, version 2.0.