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
  • How can I see all the build system commands that Cover would execute on my project?
  • How do I customise the behaviour?
  • How do I change the timeout globally or for a specific phase?
  • How do I add an option to all invocations of my build system?
  • How do I configure a build system plugin that isn’t already configured?
  • How do I adjust the behaviour of a goal?
  • How do I adjust the behaviour of phases?
  • How do I include/exclude test classes?

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

Quick guide

PreviousConfiguring Cover to work with your project's build systemNextConfiguration file in detail

Last updated 2 months ago

Was this helpful?

How can I see all the build system commands that Cover would execute on my project?

Run dcover build-debug to see the currently configured build system commands for each phase, without actually executing them. This command can be used as part of a quick feed-back loop allowing you to modify your DiffblueBuild.yaml file and inspect the changes you’ve made without needing to invoke any other Cover CLI commands.

How do I customise the behaviour?

Create a DiffblueBuild.yaml or DiffblueBuild.yml file either in the root of your project or in its module, depending on whether you want to customise Cover's behaviour for your whole project or just a particular module.

To populate the file, you have two options. The first option is to copy and paste the minimal configuration shown in the section, and extend it as desired. You can follow the instructions in this quick guide to learn how to set up the most common customisations. Note that the file must describe all the interactions between Cover and your project's build system.

The second, recommended option is to retrieve Cover's default configuration and adjust it as needed. In order to do that, run dcover build-default-config --maven , dcover build-default-config --gradle, or dcover build-default-config --ant which will save Cover's default configuration into a DiffblueBuild.yaml file in the current directory. See dcover build-default-config --help for further options such as printing to a specific directory or printing to console. Now you can make changes to your DiffblueBuild.yaml file as desired.

How do I change the timeout globally or for a specific phase?

The timeout key in the global block allows you to set a timeout for all phases unless the phase defines its own timeout. The value must be a valid ISO-8601 duration format (viz. PnDTnHnMn.nS, for example 60 minutes is PT60M).

How do I add an option to all invocations of my build system?

In the global block you can add a list of flags that will be applied to all commands in the configuration file. Flags can be any command line options or properties with specific values.

DiffblueBuild.yaml
global:
 flags:
   - --commandLineOptionName
   - -DpropertyName=propertyValue
DiffblueBuild.yaml
global:
 flags:
   - --commandLineOptionName
   - -DsystemPropertyName=propertyValue
   - -PprojectPropertyName=propertyValue
DiffblueBuild.yaml
global:
 flags: ~

Note: The handling of spaces in properties is not supported at the moment; you must use the = sign to set the property value, or split the option across two items in the list. No warnings will be emitted to this effect and you may find the command you’re configuring fails to execute.

How do I configure a build system plugin that isn’t already configured?

In the global block you can add a list of plugins with an appropriate configuration. For example, in Maven, the configuration the license-maven-plugin can look as follows:

DiffblueBuild.yaml
global:
  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

To disable the plugin, Cover will lookup the goals named disable. To enable, Cover will look up the goals named format. In both cases, if there is a goal specified, the resultant argument will be a concatenation of the name and the goal , and if there is a flag specified, it will too be added to the resultant argument. For the above example, the resultant arguments are:

  • to enable the plugin: … com.mycila:license-maven-plugin:format …

  • to disable the plugin: … -Dlicense.skip=true …

Note: This is not supported for Ant build systems

How do I adjust the behaviour of a goal?

To adjust the behaviour of a goal in a list of goals, you can adjust its flags, goal and name. The flags will be added after the name:goal (or just goal if name is not present – indicated with ~).

Note: Maven’s lifecycle goals are not the same as those of the corresponding plugins. For example, org.apache.maven.plugins:maven-install-plugin:install is not the same as install.

How do I adjust the behaviour of phases?

Phases contain a list of goals to add to an invocation of the build system. Some phases have multiple goals, others have a single goal. The structure of the goal has been described above. To adjust the behaviour of a phase add or remove a goal from the list of goals.

How do I include/exclude test classes?

During the test and coverage phases Cover needs to be able to run a single (named) test class, a set of tests that have been created by Diffblue Cover (onlyDiffblue), the set of tests that have not been created by Diffblue Cover (neverDiffblue) and all tests regardless of who/what created them (default). These four elements define a filter for the phase.

DiffblueBuild.yaml
phases:
  test:
    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}
DiffblueBuild.yaml
phases:
  test:
    filter:
      default: ~
      neverDiffblue:
        - -PexcludeTests=${DIFFBLUE_TEST_CLASS_REGEX}
      onlyDiffblue:
        - -PincludeTests=${DIFFBLUE_TEST_CLASS_REGEX}
      named:
        - --tests=${DIFFBLUE_TEST_CLASS}
DiffblueBuild.yaml
phases:
  test:
    filter:
      default: ~
      neverDiffblue:
        - -Dtest.excludes=**/*DiffblueTest.*
      onlyDiffblue:
        - -Dtest.includes=**/*DiffblueTest.*
      named:
        - -Dtest.includes=**/${DIFFBLUE_TEST_FILE}.java

Note: The Gradle filters use the name of the class whereas Maven filters use the name of the file.

Note: Under Gradle, there’s no command line option to exclude tests from the test suite. This (and a property to include tests) are configured as part of the plugin used to listen to events.

Note: The Ant configuration will need to be adjusted to suit your project's configuration

Overview