Skip to content

A Maven plugin that generates the banner for a Spring Boot Application

License

Notifications You must be signed in to change notification settings

acanda/spring-banner-plugin

Repository files navigation

Spring Banner Plugin

The Spring Banner Plugin is a Maven plugin generating the banner that is printed on start up of a Spring Boot application.

 ____             _             ____
/ ___| _ __  _ __(_)_ __   __ _| __ )  __ _ _ __  _ __   ___ _ __
\___ \| '_ \| '__| | '_ \ / _` |  _ \ / _` | '_ \| '_ \ / _ \ '__|
 ___) | |_) | |  | | | | | (_| | |_) | (_| | | | | | | |  __/ |
|____/| .__/|_|  |_|_| |_|\__, |____/ \__,_|_| |_|_| |_|\___|_|
      |_|                 |___/
Version: 1.6.0, Server: localhost:8080, Active Profiles: none

Usage

Maven Central
<build>
    <plugins>
        <plugin>
            <groupId>ch.acanda.maven</groupId>
            <artifactId>spring-banner-plugin</artifactId>
            <version>1.6.0</version>
            <executions>
                <execution>
                    <id>generate-spring-banner</id>
                    <phase>generate-resources</phase> <!--(1)-->
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration> <!--(2)-->
                <text>${project.name}</text>
                <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                <filename>banner.txt</filename>
                <includeInfo>true</includeInfo>
                <info>Version: ${application.version:${project.version}}, Server: ${server.address:localhost}:${server.port:8080}, Active Profiles: ${spring.profiles.active:none}</info>
                <font>standard</font>
                <color>default</color>
                <useNonBreakingSpace>false</useNonBreakingSpace>
            </configuration>
        </plugin>
    </plugins>
</build>
  1. The default phase is generate-resources. This can be omitted unless you want to generate the banner in another phase.

  2. All configuration parameters are optional. The values in this example are the default values.

Configuration Parameters

All parameters are optional.

text

The banner text.
Default value: ${project.name}
Property: banner.text

outputDirectory

The directory of the banner file.
Default value: ${project.build.outputDirectory}
Property: banner.outputDirectory

filename

The name of the banner file.
Default value: banner.txt
Property: banner.filename

includeInfo

true (default): include the info line
false: do not include the info line
Property: banner.includeInfo

info

The line to print under the banner when includeInfo is true.
Default value: Version: ${application.version:${project.version}}, Server: ${server.address:localhost}:${server.port:8080}, Active Profiles: ${spring.profiles.active:none}
Property: banner.info

font

The FIGlet font to be used for the banner. This can either be the name of a built-in font, or a path to a custom FIGlet font file (.flf).
Available built-in fonts: banner, big, block, bubble, digital, ivrit, lean, mini, mnemonic, script, shadow, slant, small, smscript, smshadow, smslant, standard, term.
Custom fonts must be prefixed with file: and should be referenced using the full path, e.g. <font>file:${project.basedir}/fonts/chunky.flf</font>. Relative paths are relative to the working directory. The font file is only needed during compile time and does not need to be included in the final jar.
Default value: standard
Property: banner.font

color

The color of the banner. Valid values are: default, black, red, green, yellow, blue, magenta, cyan, white, bright black, bright red, bright green, bright yellow, bright blue, bright magenta, bright cyan and bright white.
Default value: default
Property: banner.color

useNonBreakingSpace

If set to true, then all spaces are replaced with non-breaking spaces.
DefaultValue: false
Property: banner.useNonBreakingSpace

Requirements

You need to run Maven with Java 17 to use the plugin.

Build Status

GitHub Actions Build Status Coverage Status Sonar Quality Gate Status Sonar Security Rating Sonar Reliability Rating Sonar Maintainability Rating Sonar Vulnerabilites Sonar Bugs

License

The Spring Banner Plugin is licensed under the Apache License, Version 2.0.