Default configuration

By default, Cover uses its own internal configuration to interact with your project's build system (currently, Cover supports Maven and Gradle). You can retrieve this default configuration and use it as a starting point for defining your own DiffblueBuild.yaml file that then overrides the default behaviour.

Default Maven configuration

For the latest version of this configuration (including comments describing the content, which are omitted here for brevity), run dcover build-debug --dump=maven.

DiffblueBuild.yaml
meta:
  version: 1
  toolName: maven

cmd:
  windows:
    - mvnw.cmd
    - mvn.cmd
  linux:
    - mvnw
    - mvn
  macos:
    - mvnw
    - mvn
global:
  flags:
    - -Dmaven.ext.class.path=${DIFFBLUE_MAVEN_SPY_JAR}
    - -Dcom.diffblue.cover.skipTests=true
    - --batch-mode
    - --projects=${MODULE}
    - --settings=${DIFFBLUE_MAVEN_USER_SETTINGS}
    - --global-settings=${DIFFBLUE_MAVEN_GLOBAL_SETTINGS}

  timeout: PT10M

  plugins:
    - name: com.mycila:license-maven-plugin
      disable: disable
      enable: format
      flags: ~
      goals:
        - name: format
          goal: format
          flags: ~
        - name: disable
          goal: ~
          flags:
            - -Dlicense.skip=true

    - name: com.diffplug.spotless:spotless-maven-plugin
      disable: disable
      enable: apply
      flags: ~
      goals:
        - name: apply
          goal: apply
          flags:
            - -DspotlessFiles=${DIFFBLUE_TEST_FILE_REGEX}
        - name: disable
          goal: ~
          flags:
            - -Dspotless.check.skip=true

    - name: org.apache.maven.plugins:maven-checkstyle-plugin
      disable: disable
      enable: check
      flags: ~
      goals:
        - name: check
          goal: checkstyle::check
          flags:
            - -Dcheckstyle.failOnViolation=false
        - name: disable
          goal: ~
          flags:
            - -Dcheckstyle.skip=true

    - name: io.spring.javaformat:spring-javaformat-maven-plugin
      disable: disable
      enable: apply
      flags: ~
      goals:
        - name: apply
          goal: spring-javaformat:apply
          flags: ~
        - name: disable
          goal: ~
          flags:
            - -Dspring-javaformat.skip=true

phase:

  info:
    goals:
      - name: ~
        goal: install
        flags:
          - -Dmaven.compiler.failOnWarning=false
          - --also-make
          - -DskipTests
          - -DskipITs
          - --threads=1C

  launcher: ~

  clean:
    goals:
      - name: ~
        goal: clean
        flags:
          - --also-make

  build:
    goals:
      - name: ~
        goal: install
        flags:
          - -Dmaven.compiler.failOnWarning=false
          - --also-make
          - -DskipTests
          - -DskipITs
          - --threads=1C

  test:
    timeout: PT60M
    goals:
      - name: ~
        goal: test
        flags:
          - -DfailIfNoTests=false
          - -Dsurefire.failIfNoSpecifiedTests=false
          - -Dmaven.test.failure.ignore=True
          - ${DIFFBLUE_TEST_FILTER}
    filter:
      default: ~
      neverDiffblue:
        - -Dtest=!${DIFFBLUE_TEST_FILE_REGEX},**/Test*.java,**/*Test.java,**/*Tests.java,**/*TestCase.java
      onlyDiffblue:
        - -Dtest=${DIFFBLUE_TEST_FILE_REGEX}
      named:
        - -Dtest=${DIFFBLUE_TEST_FILE}

  coverage:
    timeout: PT60M
    goals:
      - name: org.jacoco:jacoco-maven-plugin
        goal: prepare-agent
        flags:
          - -Djacoco.skip=false

      - name: ~
        goal: test
        flags:
          - -DfailIfNoTests=false
          - -Dsurefire.failIfNoSpecifiedTests=false
          - -Dmaven.test.failure.ignore=True
          - ${DIFFBLUE_TEST_FILTER}

      - name: org.jacoco:jacoco-maven-plugin
        goal: report
        flags:
          - -Djacoco.skip=false
    filter:
      default: ~
      neverDiffblue:
        - -Dtest=!${DIFFBLUE_TEST_FILE_REGEX},**/Test*.java,**/*Test.java,**/*Tests.java,**/*TestCase.java
      onlyDiffblue:
        - -Dtest=${DIFFBLUE_TEST_FILE_REGEX}
      named:
        - -Dtest=${DIFFBLUE_TEST_FILE}

  refactor:
    timeout: PT30M
    goals:
      - name: ~
        goal: install:install-file
        flags:
          - -Dfile=${DIFFBLUE_COVER_REFACTORING_RECIPES_JAR}
          - -DgroupId=${DIFFBLUE_COVER_REFACTORING_RECIPES_GROUP_ID}
          - -DartifactId=${DIFFBLUE_COVER_REFACTORING_RECIPES_ARTIFACT_ID}
          - -Dversion=${DIFFBLUE_COVER_REFACTORING_RECIPES_VERSION}
          - -Dpackaging=jar
      - name: ~
        goal: install:install-file
        flags:
          - -Dfile=${DIFFBLUE_OPEN_REWRITE_JAR}
          - -DgroupId=${DIFFBLUE_OPEN_REWRITE_GROUP_ID}
          - -DartifactId=${DIFFBLUE_OPEN_REWRITE_ARTIFACT_ID}
          - -Dversion=${DIFFBLUE_OPEN_REWRITE_VERSION}
          - -Dpackaging=jar
      - name: ~
        goal: install:install-file
        flags:
          - -Dfile=${DIFFBLUE_OPEN_REWRITE_POM}
          - -DgroupId=${DIFFBLUE_OPEN_REWRITE_GROUP_ID}
          - -DartifactId=${DIFFBLUE_OPEN_REWRITE_ARTIFACT_ID}
          - -Dversion=${DIFFBLUE_OPEN_REWRITE_VERSION}
          - -Dpackaging=pom
      - name: org.openrewrite.maven:rewrite-maven-plugin
        goal: run
        flags:
          - -Drewrite.activeRecipes=com.diffblue.cover.refactoring.Recipe
          - -Drewrite.activeStyles=org.openrewrite.java.Autodetect
          - -Drewrite.configLocation=${DIFFBLUE_REWRITE_CONFIG}

  validate:
    timeout: PT60M
    goals:
      - name: ~
        goal: install
        flags:
          - --also-make

Default Gradle configuration

For the latest version of this configuration (including comments describing the content, which are omitted here for brevity), run dcover build-debug --dump=gradle.

DiffblueBuild.yaml
meta:
  version: 1
  toolName: gradle

cmd:
  windows:
    - ./gradlew.bat
    - ./gradlew
    - gradle.bat
    - gradle
  linux:
    - ./gradlew
    - gradle
  macos:
    - ./gradlew
    - gradle

global:
  flags:
    - --init-script=${DIFFBLUE_GRADLE_INIT_SCRIPT}
    - --info
    - --console=plain
    - -PskipTestOptimizer=true
    - -Dcom.diffblue.cover.buildsystem.gradle.model-jar=${DIFFBLUE_GRADLE_SPY_JAR}
    - --no-daemon

  timeout: PT10M

  plugins:
    - name: io.spring.javaformat.gradle.SpringJavaFormatPlugin
      disable: disable
      enable: format
      flags: ~
      goals:
        - name: format
          goal: ${MODULE_PATH}format
          flags: ~
        - name: disable
          goal: ~
          flags:
            - -Pspring-javaformat.skip=true

phase:

  info: ~

  launcher:
    timeout: PT30S
    goals:
      - name: ~
        goal: downloadDependencies
        flags:
          - --
          - --groupId=${DIFFBLUE_GROUP_ID}
          - --artifactId=${DIFFBLUE_ARTIFACT_ID}
          - --version=${DIFFBLUE_VERSION}

  clean:
    goals:
      - name: ~
        goal: ${MODULE_PATH}clean

  build:
    goals:
      - name: ~
        goal: ${MODULE_PATH}assemble
      - name: ~
        goal: ${MODULE_PATH}testClasses

  test:
    timeout: PT60M
    goals:
      - name: ~
        goal: ${MODULE_PATH}test
        flags:
          - ${DIFFBLUE_TEST_FILTER}
    filter:
      default: ~
      neverDiffblue:
        - -PexcludeTests=${DIFFBLUE_TEST_CLASS_REGEX}
      onlyDiffblue:
        - -PincludeTests=${DIFFBLUE_TEST_CLASS_REGEX}
      named:
        - --tests=${DIFFBLUE_TEST_CLASS}

  coverage:
    timeout: PT60M
    goals:
      - name: ~
        goal: ${MODULE_PATH}test
        flags:
          - -PignoreFailures=true
          - ${DIFFBLUE_TEST_FILTER}
      - name: ~
        goal: ${MODULE_PATH}jacocoTestReport
    filter:
      default: ~
      neverDiffblue:
        - -PexcludeTests=${DIFFBLUE_TEST_CLASS_REGEX}
      onlyDiffblue:
        - -PincludeTests=${DIFFBLUE_TEST_CLASS_REGEX}
      named:
        - --tests=${DIFFBLUE_TEST_CLASS}

  refactor:
    timeout: PT50M
    goals:
      - name: ~
        goal: rewriteRun
        flags:
          - --init-script=${DIFFBLUE_COVER_REFACTORING_INIT_SCRIPT}
          - -DconfigFile=${DIFFBLUE_REWRITE_CONFIG}

  validate:
    timeout: PT60M
    goals:
      - name:
        goal: ${MODULE_PATH}build
      - name:
        goal: ${MODULE_PATH}check

Last updated