Default configuration

By default, Cover uses its own internal configuration to interact with your project's build system. Currently, Cover supports Maven and Gradle automatically, and provides a sample configuration for Ant that you will need to customize to suit your project. 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-default-config --maven.

DiffblueBuild.yaml
meta:
  version: 3.2
  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_PATTERN}
        - 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: validate
        flags:
          - --also-make

  classpath:
    goals:
      - name: ~
        goal: dependency:build-classpath

  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_GLOB_PATTERN},**/Test*.java,**/*Test.java,**/*Tests.java,**/*TestCase.java
      neverDiffblueTag:
        - -Dtest=!${DIFFBLUE_TEST_FILE_GLOB_PATTERN},**/Test*.java,**/*Test.java,**/*Tests.java,**/*TestCase.java
        - -DexcludedGroups=MaintainedByDiffblue,ContributionFromDiffblue      
      onlyDiffblue:
        - -Dtest=${DIFFBLUE_TEST_FILE_GLOB_PATTERN}
      onlyDiffblueTag:
        - -Dtest=!${DIFFBLUE_TEST_FILE_GLOB_PATTERN},**/Test*.java,**/*Test.java,**/*Tests.java,**/*TestCase.java
        - -Dgroups=MaintainedByDiffblue,ContributionFromDiffblue      
      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_GLOB_PATTERN},**/Test*.java,**/*Test.java,**/*Tests.java,**/*TestCase.java
      neverDiffblueTag:
        - -Dtest=!${DIFFBLUE_TEST_FILE_GLOB_PATTERN},**/Test*.java,**/*Test.java,**/*Tests.java,**/*TestCase.java
        - -DexcludedGroups=MaintainedByDiffblue,ContributionFromDiffblue      
      onlyDiffblue:
        - -Dtest=${DIFFBLUE_TEST_FILE_GLOB_PATTERN}
      onlyDiffblueTag:
        - -Dtest=!${DIFFBLUE_TEST_FILE_GLOB_PATTERN},**/Test*.java,**/*Test.java,**/*Tests.java,**/*TestCase.java
        - -Dgroups=MaintainedByDiffblue,ContributionFromDiffblue      
      named:
        - -Dtest=${DIFFBLUE_TEST_FILE}

  refactor:
    timeout: PT30M
    goals:
      - name: ~
        goal: install:install-file
        once: true
        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
        once: true
        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
        once: true
        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-default-config --gradle.

Default Ant configuration

For the latest version of this configuration (including comments describing the content, which are omitted here for brevity), run dcover build-default-config --ant.

Last updated

Was this helpful?