Class GreenerPlugin

java.lang.Object
com.patbaumgartner.greener.gradle.GreenerPlugin
All Implemented Interfaces:
org.gradle.api.Plugin<org.gradle.api.Project>

public class GreenerPlugin extends Object implements org.gradle.api.Plugin<org.gradle.api.Project>
Gradle plugin entry point for greener-spring-boot.

Registers the GreenerExtension DSL block and the three tasks:

  • measureEnergy — runs the Spring Boot application under Joular Core and compares the measured energy against a baseline.
  • updateEnergyBaseline — promotes the most recent measurement result as the new baseline.
  • energyDoctor — runs preflight environment checks and prints a PASS / WARN / FAIL report with actionable hints.

Minimal build.gradle.kts configuration

An external workload tool is required — set either externalTrainingCommand (inline) or externalTrainingScriptFile (path to a shell script). The plugin will fail at runtime if neither is configured.


 plugins {
     id("com.patbaumgartner.greener-spring-boot") version "<version>"
 }

 greener {
     // REQUIRED – one of externalTrainingCommand / externalTrainingScriptFile
     externalTrainingCommand.set("oha -n 500 -c 10 \${APP_URL}/actuator/health")
 }
 
  • Constructor Details

    • GreenerPlugin

      public GreenerPlugin()
  • Method Details

    • apply

      public void apply(org.gradle.api.Project project)
      Specified by:
      apply in interface org.gradle.api.Plugin<org.gradle.api.Project>