Skip to main content

Quality Plugin Configuration

Scaffold v5 supplies root quality defaults and shared app-service conventions. Configure project- specific values in the generated root or module build.gradle files after the plugins block.

Sonar​

The root convention configures the sonar task with these defaults:

PropertyDefault
sonar.sourceEncodingUTF-8
sonar.modulesDiscovered Gradle module directories, relative to the root project
sonar.sourcessrc,deployment,settings.gradle,build.gradle, plus each module's build.gradle
sonar.exclusions**/MainApplication.java,**/**.bin,**/deployment/**
sonar.testssrc/test
sonar.java.binaries**/build/classes/java/main
sonar.junit.reportsPath**/build/test-results/test
sonar.java.coveragePluginjacoco
sonar.coverage.jacoco.xmlReportPathsbuild/reports/jacocoMergedReport/jacocoMergedReport.xml
sonar.pitest.reportPathsbuild/reports/pitest/mutations.xml
sonar.externalIssuesReportPathsbuild/issues.json

The root sonar task depends on jacocoMergedReport. When Pitest is declared, it also depends on pitestReportAggregate.

You can customize or replace properties in the root build.gradle:

sonar {
properties {
property "sonar.exclusions", "**/generated/**,**/config/**"
property "sonar.sources", "src/main/java"
property "sonar.projectKey", "my-service"
}
}

Pitest​

Pitest is configured by the child convention in each subproject where the Pitest plugin is applied. The defaults are:

SettingDefault
targetClassesThe configured project package followed by .*
excludedClasses, excludedTestClassesEmpty
pitestVersionConstants.PITEST_VERSION
verbosefalse
outputFormatsXML, HTML
threadsAvailable processors
exportLineCoveragetrue
useClasspathFiletrue
withHistorytrue
timestampedReportsfalse
junit5PluginVersionConstants.PITEST_JUNIT5_VERSION
failWhenNoMutationsfalse
jvmArgs-XX:+AllowRedefinitionToAddDeleteMethods
fileExtensionsToFilterxml, orbit

Because Pitest is applied to child projects, configure its extension inside subprojects in the root build.gradle. This block runs after the scaffold defaults, so values set here override them:

subprojects {
pitest {
targetClasses = ['com.example.service.*']
outputFormats = ['XML']
threads = 4
}
}

Pitest settings and aggregation are active only when info.solidsoft.pitest is declared in the root plugins {} block. The ca --mutation=false generator option omits that declaration from a new project.

App Service Defaults​

The root convention applies Spring Boot to app-service unless the user already applied it, then sets up the standard packaging tasks. It also adds these dependencies when they are not already present:

ConfigurationDependency
implementationorg.springframework.boot:spring-boot-starter
runtimeOnlyorg.springframework.boot:spring-boot-devtools
testImplementationtools.jackson.core:jackson-databind
testImplementationcom.tngtech.archunit:archunit:<Constants.ARCH_UNIT_VERSION>

If the developer declares ArchUnit in any app-service configuration, the convention leaves that dependency and its version unchanged.

Packaging defaults:

  • The standard jar task is disabled.
  • explodedJar copies the plain jar contents into build/exploded.
  • bootJar is named <root-project-name>.jar.

OpenTelemetry Java agent​

When cleanPlugin.otel is true (or the project was generated with ca --otel=true), the root convention configures app-service with:

  • An otelAgent configuration depending on io.opentelemetry.javaagent:opentelemetry-javaagent at the plugin-managed version.
  • A copyOtelAgent task that copies the agent to build/otel/opentelemetry-javaagent.jar.
  • bootJar depending on copyOtelAgent.
  • bootRun attaching the agent via -javaagent.

Enable it in an existing project:

cleanPlugin {
otel = true
}