Skip to content

bhuyanp/spring-banner-gradle-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Banner Gradle Plugin

Spring Banner Gradle Plugin is for Spring Boot applications and it generates fun and colorful banners. Opinionated defaults are chosen for the best banner experience. All you have to do is include the plugin to your build file.

Requirement:

JDK: 17+ SpringBoot: 3.x.x

Usage:

plugins {
    ..
    ..
    id("io.github.bhuyanp.spring-banner-gradle-plugin").version("1.2")
}

Previews

Run this command to preview the banner in different fonts.

./gradlew printDefaultFonts
Dark Theme: Dark Theme Banner 1 Dark Theme Banner 2 Dark Theme Banner 3 Dark Theme Banner 4
Light Theme: Light Theme Banner 1 Light Theme Banner 2 Light Theme Banner 3 Light Theme Banner 4
Surprise Me Theme: Surprise Me Theme Banner 1 Surprise Me Theme Banner 2 Surprise Me Theme Banner 3 Surprise Me Theme Banner 4
Surprise Me Light Theme: Surprise Me Light Theme Banner 1 Surprise Me Light Theme Banner 2 Surprise Me Light Theme Banner 3 Surprise Me Light Theme Banner 4

Tasks

Plugin comes with four tasks.

Tasks

- GenerateBanner [DEFAULT]
    Writes generated banner.txt to the application resources folder

- PrintBanner
    Prints banner in the console as per current project configuration

- PrintAllFonts
    Prints banners in the console using all the fonts available in the library

- PrintDefaultFonts
    Prints banners in the console using all the default fonts plugin cycles through when no custom fonts are provided

Customizations

Plugin comes with ample customizability. You can pick and choose which part you want to customize.

Generate Banner

springBanner {
    generateBanner = true // Flag to generate top section of the banner. Default is true.
}

Generate Caption

springBanner {
    generateCaption = true // Flag to generate bottom section(caption) of the banner. Default is true.
}

Banner Text

Banner text that appears at the top. If not provided, plugin takes project name, removes dashes from it and capitalizes the first letter of every word. Custom texts can be provided as shown below.

springBanner {
    bannerText = "Funky Banner"
}

Theme Preset

Check the screenshots for the themes generated by different theme presets. SURPRISE_ME is default and it generates random theme for the banner and caption every time it is invoked. For details about other theme presets, refer THEME_PRESET

springBanner {
    themePreset =
        THEME_PRESET.SURPRISE_ME // Theme preset to use for the banner styling. Default is SURPRISE_ME. Other options include DARK, LIGHT, SURPRISE_ME_LIGHT etc.
}

Banner Fonts

You can provide one or more banners fonts to the plugin. For more than one fonts, plugin will randomly pick font everytime it is invoked. If no fonts are provided then plugin randomly cycles through a chosen list of fonts. DEFAULT_FONTS can be found here. Constants.java

springBanner {
    bannerFonts = listOf(
        "ansiregular",
        "ansishadow",
        "banner3_d",
        "banner4",
        "bigmoneyne",
        "bolger"
    )
}

Caption

Caption appears below the banner and this section can be used to display useful information about the application. Plugin provides default caption with several useful info about the application. Check the screenshots for default caption. Fine grain control over the caption can be achieved using CaptionSetting as shown below.

You can choose to hide certain info from the caption, change the bullet style and even provide custom caption text.

springBanner {
    captionSetting =
        CaptionSetting.builder() // Caption settings for the fine grain control over banner caption. It includes options like caption bullet style, whether to hide several versions etc.
            .text(
                """ 
            App: ${'$'}appVersion
            Spring Boot: ${'$'}springBootVersion
            JDK: ${'$'}jdkVersion
            Gradle: ${'$'}gradleVersion
            XYZ Library: 1.0.0
        """.trimIndent())
            /* Custom caption text to override default caption generated by the plugin. Default caption includes Spring Boot version, JDK version and Gradle version. You can use the following variables in the caption text to include dynamic values:
                    ${'$'}appVersion - The version of your application (from build file)
                    ${'$'}springBootVersion - The version of Spring Boot being used
                    ${'$'}jdkVersion - The version of JDK being used
                    ${'$'}gradleVersion - The version of Gradle being used
             */
            .hideAppVersion(false) // Whether to hide the app version in the caption. Default is false.
            .hideSpringBootVersion(false) // Whether to hide the Spring Boot version in the caption. Default is false.
            .hideJDKVersion(false) // Whether to hide the JDK. Default is false.
            .hideGradleVersion(false) // Whether to hide the Gradle version in the caption. Default is false.
            .captionBulletStyle(CaptionSetting.CAPTION_BULLET_STYLE.GT) // Bullet style to use for the caption. Default is GT (greater than symbol). Other options include PIPE("|"),GTA("->"),POUND("#"),DASH("-"),DOLLAR("$"),RANDOM("Random"),NONE("").
            .build() // Caption settings for the fine grain control over banner caption. It includes options like caption bullet style, whether to hide several versions etc.
}

IntelliJ Plugin

IntelliJ plugin with similar functionality and lot more customizability located at Funnky Banners

Maven Plugin

Maven plugin with similar functionality located at https://github.com/bhuyanp/spring-banner-maven-plugin

License

This project is licensed under Apache License, version 2.0.

Credits

Love the Plugin?

Please consider supporting our efforts.

Buy Me A Coffee

About

A gradle plugin which generates fun and colorful banners for SpringBoot applications.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages