LogoLogo
diffblue.comFree trial
  • Discover Diffblue Cover
  • Get Started
    • What is Diffblue Cover?
    • Get started
      • Free trial
      • Get started - Cover Plugin
      • Get started - Cover CLI
      • Get started - Cover Pipeline
      • Get started - Cover Reports
    • Specs & Reqs
    • Reference Deployments
    • Licensing
      • Online license activation
      • Offline license activation
      • Diffblue License Manager
    • Update Cover
    • FAQs
    • Diffblue Learning
      • Get started
        • Just the basics
        • Free trial
        • Cover Plugin (IDE)
        • Cover CLI (Command Line)
      • Developer
        • Unit tests (IDE)
        • Unit tests (CLI)
        • Test coverage
      • DevOps
        • GitHub
        • GitLab
        • Other CI
      • Administrator
        • Admin - IntelliJ
        • Admin - CLI
        • Admin - Reports
      • Test coverage
        • Developer
        • Senior developer
        • Cover Reports Administrator
  • EVALUATION & ONBOARDING
    • Proof of Value
    • Jumpstart
      • Prerequisites for onboarding
      • Phase 1: Up and running
        • Module 1: Create your Cover unit test baseline
        • Module 2: Cover Pipeline CI integration
      • Phase 2: Developer productivity
        • Module 3: Getting started using Cover
        • Module 4: Introduction to Cover Reports
      • Phase 3: Advanced topics
        • Module 5: Speed up your test execution
        • Module 6: Getting more from Cover
  • Features
    • Cover Plugin
      • Writing tests
        • Gutter icons
        • Menu options
        • Run configurations
        • Cover Plugin tool window
        • Test Review
        • Test examples
        • Creating partial tests
        • Creating skeleton tests
        • Covering all enum values
        • Test insertion order
        • Diffblue Sandbox
        • Environment Check Cache
      • Project configuration
        • General dependencies
        • Test framework dependencies
      • Cover Plugin settings
        • Test Naming
        • Test Formatting
        • Spring configuration options
        • Method Annotations
        • Test Directory
        • Reset Cover Plugin settings
      • Cover Plugin admin
        • Core Maintenance
        • Cover Plugin toolbar menu
        • Cover Plugin status bar widget
        • Telemetry
        • Memory management
        • Using SonarQube with Cover Plugin
        • Log files
        • Troubleshooting
    • Cover CLI
      • Writing tests
        • Command summary
        • Test examples
        • Creating partial tests
        • Customizing test inputs
        • Customizing test setup
        • Test naming
        • Test formatting
        • Test insertion order
        • Patch files
        • Diffblue Sandbox
        • Operational behaviors
        • Test validation
      • Project configuration
        • Preflight checks
        • General dependencies
        • Test framework dependencies
        • Compiling your project successfully
          • Building a Maven project
          • Building a Gradle project
        • Configuring Cover to work with your project's build system
          • Quick guide
          • Configuration file in detail
          • Getting Started with Ant Projects
          • Default configuration
        • Mocking using Mockito
        • Spring profiles
        • Runtime environment
      • Commands & Arguments
        • Environment configuration for CI
        • Packages, classes, and methods
        • Quoting command line arguments
        • Argument files
      • Cover CLI admin
        • Core Maintenance
        • Telemetry
        • Memory management
        • Using Cover CLI in Eclipse
        • Using SonarQube with Cover CLI
        • Log files
        • Troubleshooting
      • Environment Configuration
    • Cover Pipeline
      • Cover Pipeline for CI
        • Quick Start - General
        • Quick Start - Jenkins
        • Quick Start - Azure Pipelines
        • Quick Start - AWS Codebuild
        • Integrating Diffblue Cover into CI on pull requests
        • Installation - VMs or CI run
      • Cover Pipeline for GitLab
        • Introduction
        • Installation and initial setup
        • GitLab workflow
        • Configuration
        • Troubleshooting
        • Related topics
      • Cover Pipeline for GitHub
        • Introduction
        • Installation and initial setup
        • GitHub workflow
        • Configuration
        • Troubleshooting
        • Related topics
    • Cover Reports
      • Cover Reports Contributor
        • Java project config (JaCoCo)
        • Generate and upload reports bundles
        • Authenticated uploads
      • Cover Reports User
        • Navigation
        • Dashboards
        • Telemetry data
        • Export API
        • Considerations
      • Cover Reports Administrator
        • Install and update Cover Reports
        • Configuration options
        • Database backup
        • SSO with Cover Reports
        • Uninstall Cover Reports
    • Cover Optimize
      • Get started - Cover Optimize
      • Cover Optimize & Gradle
      • Cover Optimize & Maven
      • Patch files
    • Cover Refactor
      • Get started - Cover Refactor
    • Cover Annotations
      • Mocking Annotations
      • Custom Input Annotations
      • Interesting Value Annotations
    • Output Codes
      • E - Environment Codes
      • L - License Codes
      • R - Reason Codes
      • T - Testability Codes
      • V - Validation Codes
      • Working with output codes
        • Working with code E020
        • Working with codes E057 to E065
        • Working with code E085
        • Working with code R005
        • Working with code R006
        • Working with code R008
        • Working with code R011
        • Working with code R012
        • Working with code R013
        • Working with code R026
        • Working with code R031
        • Working with code V003
    • Tutorials
      • How to measure test quality
      • How to improve code coverage
      • How to test a new feature
      • How to find regressions
      • How to use Diffblue Cover in test driven development (TDD)
      • How to write tests for Kotlin projects
      • Examples of tests created by Diffblue Cover
      • Best practices for testing private methods
  • Updates & Upgrades
    • Update Cover
    • Cover Editions
    • What's new
    • Release archive
      • 2025-05-01
      • 2025-04-02
      • 2025-04-01
      • 2025-03-02
      • 2025-03-01
      • 2025-02-02
      • 2025-02-01
      • 2025-01-02
      • 2025-01-01
      • 2024-12-02
      • 2024-12-01
      • 2024-11-02
      • 2024-11-01
      • 2024-10-02
      • 2024-10-01
      • 2024-09-02
      • 2024-09-01
      • 2024-08-02
      • 2024-08-01
      • 2024-07-04
      • 2024-07-03
      • 2024-07-01
      • 2024-06-02
      • 2024-06-01
      • 2024-05-02
      • 2024-05-01
      • 2024-04-02
      • 2024-04-01
      • 2024-03-02
      • 2024-03-01
      • 2024-02-02
      • 2024-02-01
      • 2024-01-02
      • 2024-01-01
      • 2023-12-02
      • 2023-12-01
      • 2023-11-03
      • 2023-11-02
      • 2023-11-01
      • 2023-10-02
      • 2023-10-01
      • 2023-09-02
      • 2023-09-01
      • 2023-08-02
      • 2023-08-01
      • 2023-07-03
      • 2023-07-02
      • 2023-07-01
      • 2023-06-02
      • 2023-06-01
      • 2023-05-02
      • 2023-05-01
      • 2023-04-02
      • 2023-04-01
      • 2023-03-02
      • 2023-03-01
      • 2023-02-02
      • 2023-02-01
      • 2023-01-02
      • 2023-01-01
      • 2022-12-02
      • 2022-12-01
      • 2022-11-02
      • 2022-11-01
      • 2022-10-03
      • 2022-10-02
      • 2022-10-01
      • 2022-09-02
      • 2022-09-01
      • 2022-08-05
      • 2022-08-03
      • 2022-08-02
      • 2022-08-01
      • 2022-07-02
      • 2022-07-01
      • 2022-06-02
      • 2022-06-01
      • 2022-05-02
      • 2022-05-01
      • 2022-04-02
      • 2022-04-01
      • 2022-03-02
      • 2022-03-01
      • 2022-02-02
      • 2022-02-01
      • 2022-01-02
      • 2022-01-01
      • 2021-06-02
      • 2021-02-01
  • Legal
    • Diffblue Legal
      • Diffblue End User License Agreement (EULA)
      • Cover Third Party Notices and/or Licenses
      • Privacy Notice
Powered by GitBook
On this page
  • Default Maven configuration
  • Default Gradle configuration
  • Default Ant configuration

Was this helpful?

Export as PDF
  1. Features
  2. Cover CLI
  3. Project configuration
  4. Configuring Cover to work with your project's build system

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: 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-default-config --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

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.

meta:
  version: 1
  toolName: ant

cmd:
  windows:
    - ant.cmd
    - ant.bat
    - ant
  linux:
    - ant
  macos:
    - ant
global:
  flags: 
    - -Dcover=true
  timeout: PT10M
  plugins: ~

phase:
  info:
    goals:
      - name: ~
        goal: info
        flags: ~
        
  launcher: ~
  
  clean:
    goals:
      - name: ~
        goal: clean
        flags: ~

  build:
    goals:
      - name: ~
        goal: compile
        flags: ~

  test:

    timeout: PT60M

    goals:
      - name: ~
        goal: test
        flags:
          - ${DIFFBLUE_TEST_FILTER}

    filter:
      default: ~
      neverDiffblue:
        - -Dtest.excludes=**/*DiffblueTest.*
      onlyDiffblue:
        - -Dtest.includes=**/*DiffblueTest.*
      named:
        - -Dtest.includes=**/${DIFFBLUE_TEST_FILE}.java

  coverage:
    timeout: PT60M
    goals:

      - name: ~
        goal: coverage-report
        flags:
          - ${DIFFBLUE_TEST_FILTER}

    filter:
      default: ~
      neverDiffblue:
        - -Dtest.excludes=**/*DiffblueTest.*
      onlyDiffblue:
        - -Dtest.includes=**/*DiffblueTest.*
      named:
        - -Dtest.includes=**/${DIFFBLUE_TEST_FILE}.java

  refactor: ~

  validate:
    timeout: PT60M
    goals:
      - name: ~
        goal: clean
        flags: ~

      - name: ~
        goal: test
        flags: ~
PreviousGetting Started with Ant ProjectsNextMocking using Mockito

Last updated 2 months ago

Was this helpful?