Class SpringQuickstartExtension

java.lang.Object
io.gitlab.ntduycse.extension.SpringQuickstartExtension

public class SpringQuickstartExtension extends Object
Gradle DSL extension registered as spring { } on the project.
  • Field Details

    • EXTENSION_NAME

      public static final String EXTENSION_NAME
      See Also:
    • DEFAULT_ENABLED_CONVENTIONS

      public static final List<Convention> DEFAULT_ENABLED_CONVENTIONS
    • DEFAULT_JACOCO_EXCLUDED_PATTERNS

      public static final List<String> DEFAULT_JACOCO_EXCLUDED_PATTERNS
    • DEFAULT_MAPSTRUCT_COMPILE_ARGS

      public static final List<String> DEFAULT_MAPSTRUCT_COMPILE_ARGS
    • DEFAULT_TEST_COVERAGE

      public static final BigDecimal DEFAULT_TEST_COVERAGE
    • DEFAULT_PMD_RULES_MIN_PRIORITY

      public static final int DEFAULT_PMD_RULES_MIN_PRIORITY
      See Also:
    • DEFAULT_UNIT_TEST_DIR

      public static final String DEFAULT_UNIT_TEST_DIR
      See Also:
    • DEFAULT_INTEGRATION_TEST_DIR

      public static final String DEFAULT_INTEGRATION_TEST_DIR
      See Also:
  • Constructor Details

    • SpringQuickstartExtension

      @Inject public SpringQuickstartExtension(org.gradle.api.model.ObjectFactory objects, org.gradle.api.file.ProjectLayout layout)
  • Method Details

    • coverageThreshold

      public void coverageThreshold(BigDecimal value)
      Convenience setter for getCoverageThreshold() accepting a BigDecimal.
      Parameters:
      value - the coverage threshold
    • coverageThreshold

      public void coverageThreshold(String value)
      Convenience setter for getCoverageThreshold() accepting a decimal string (e.g. "0.85").
      Parameters:
      value - the coverage threshold
    • coverageThreshold

      public void coverageThreshold(double value)
      Convenience setter for getCoverageThreshold() accepting a double in the range [0.0, 1.0].
      Parameters:
      value - the coverage threshold
    • disable

      public SpringQuickstartExtension disable(Convention... conventions)
      Removes one or more conventions from getEnabled() while keeping the rest. The current value of enabled is read at call time, so disable(...) must be invoked after any enabled.set(...) / enabled.add(...) the user wants to be effective for the removal. Usage:
       spring {
         disable(Convention.PMD)
       }
       
      Parameters:
      conventions - the conventions to disable
      Returns:
      this extension for chaining
    • enable

      public SpringQuickstartExtension enable(Convention... conventions)
      Adds one or more conventions to getEnabled() without overwriting the existing set. Usage:
       spring {
         enable(Convention.JACOCO, Convention.LOMBOK)
       }
       
      Parameters:
      conventions - the conventions to enable
      Returns:
      this extension for chaining
    • getCoverageExclusion

      public org.gradle.api.provider.ListProperty<String> getCoverageExclusion()
      Ant-style patterns excluded from JaCoCo classDirectories for jacocoTestReport and jacocoTestCoverageVerification. Defaults to DEFAULT_JACOCO_EXCLUDED_PATTERNS. Use set(...) or set([]) to replace that list entirely; an empty list applies no excludes.
      Returns:
      the coverage exclusion patterns
    • getCoverageThreshold

      public org.gradle.api.provider.Property<BigDecimal> getCoverageThreshold()
      Minimum line coverage (0.0–1.0) for jacocoTestCoverageVerification. Default 0.90 (90%). For convenience prefer the overloaded setters coverageThreshold(double) / coverageThreshold(String) in build scripts.
      Returns:
      the coverage threshold
    • getEnabled

      public org.gradle.api.provider.SetProperty<Convention> getEnabled()
      Enabled conventions. Defaults to DEFAULT_ENABLED_CONVENTIONS. Use set(...) or set([]) to replace that list entirely; an empty list applies no conventions. Prefer enable(Convention...) / disable(Convention...) for additive edits.
      Returns:
      the enabled conventions
    • getIntegrationTestDir

      public org.gradle.api.file.DirectoryProperty getIntegrationTestDir()
      Directory for integration tests, relative to the project directory. Defaults to DEFAULT_INTEGRATION_TEST_DIR.

      Typed as DirectoryProperty so it participates in Gradle's file API (task inputs, Provider<RegularFile> wiring). In Groovy/Kotlin DSL build scripts you can still assign a String — Gradle coerces it via layout.projectDirectory.dir(...).

      Returns:
      the integration test directory
    • getJavaVersion

      public org.gradle.api.provider.Property<org.gradle.api.JavaVersion> getJavaVersion()
      Java language version for java { toolchain { languageVersion = ... } }. Defaults to JavaVersion.VERSION_21.
      Returns:
      the Java language version
    • getKtfmtVersion

      public org.gradle.api.provider.Property<String> getKtfmtVersion()
      ktfmt version used by the Spotless Kotlin step for Kotlin (Gradle) scripts. Defaults to Versions.KTFMT.
      Returns:
      the ktfmt version
    • getLombokVersion

      public org.gradle.api.provider.Property<String> getLombokVersion()
      Lombok version used for all org.projectlombok:lombok dependencies added by the plugin. Defaults to Versions.LOMBOK.
      Returns:
      the Lombok version
    • getMapstructCompileArgs

      public org.gradle.api.provider.ListProperty<String> getMapstructCompileArgs()
      MapStruct compiler arguments for JavaCompile tasks. Defaults to DEFAULT_MAPSTRUCT_COMPILE_ARGS. Use set(...) or set([]) to replace that list entirely; an empty list applies no arguments.
      Returns:
      the MapStruct compiler arguments
    • getMapstructLombokBindingVersion

      public org.gradle.api.provider.Property<String> getMapstructLombokBindingVersion()
      Lombok/MapStruct binding version used for org.projectlombok:lombok-mapstruct-binding (added on annotationProcessor when Lombok is detected). Defaults to Versions.MAPSTRUCT_LOMBOK_BINDING.
      Returns:
      the Lombok/MapStruct binding version
    • getMapstructSpringExtensionsVersion

      public org.gradle.api.provider.Property<String> getMapstructSpringExtensionsVersion()
      Version used for org.mapstruct.extensions.spring:mapstruct-spring-extensions and mapstruct-spring-annotations. Defaults to Versions.MAPSTRUCT_SPRING_EXTENSIONS.
      Returns:
      the MapStruct Spring extensions version
    • getMapstructVersion

      public org.gradle.api.provider.Property<String> getMapstructVersion()
      MapStruct version used for org.mapstruct:mapstruct and mapstruct-processor. Defaults to Versions.MAPSTRUCT.
      Returns:
      the MapStruct version
    • getPmdRulesMinPriority

      public org.gradle.api.provider.Property<Integer> getPmdRulesMinPriority()
      Minimum priority for PMD rules. Defaults to DEFAULT_PMD_RULES_MIN_PRIORITY.
      Returns:
      the minimum priority for PMD rules
    • getPmdToolVersion

      public org.gradle.api.provider.Property<String> getPmdToolVersion()
      PMD tool version applied to every Pmd task (pmd { toolVersion }). Defaults to Versions.PMD.
      Returns:
      the PMD tool version
    • getPrettierVersion

      public org.gradle.api.provider.Property<String> getPrettierVersion()
      Prettier version used by the Spotless YAML step. Defaults to Versions.PRETTIER.
      Returns:
      the Prettier version
    • getRepoType

      public org.gradle.api.provider.Property<RepositoryType> getRepoType()
      Returns:
      the repository type
    • getUnitTestDir

      public org.gradle.api.file.DirectoryProperty getUnitTestDir()
      Directory for unit tests, relative to the project directory. Defaults to DEFAULT_UNIT_TEST_DIR.

      Typed as DirectoryProperty so it participates in Gradle's file API (task inputs, Provider<RegularFile> wiring). In Groovy/Kotlin DSL build scripts you can still assign a String — Gradle coerces it via layout.projectDirectory.dir(...).

      Returns:
      the unit test directory
    • getVerbose

      public org.gradle.api.provider.Property<Boolean> getVerbose()
      When true, the plugin emits detailed progress lines (dependency lists, compiler arguments, coverage exclusions, task graph) at lifecycle level. When false (default), those details are demoted to info level and only concise headers remain visible on a normal build. Can also be toggled at the command line with -Pspring.verbose=true.
      Returns:
      the verbose flag