# Configuring Cover to work with your project's build system

Cover CLI needs to work in concert with your project's build system, for example to build your project, run tests, apply style checks to the created tests, etc. At the moment, Cover supports Maven and Gradle build systems. For most projects, Cover needs no help talking to the project's build system and everything works smoothly out of the box. However, we understand that the build system configuration for a project can get complicated. Here we describe a convenient way to configure how Cover invokes your project's build system.

## Overview

Cover CLI invokes project's build system at various points of execution, so called phases:

| Phase       | Purpose                                                                                                                                                            |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `info`      | Discover information about the layout and settings of the project; this does not include the complete classpath.                                                   |
| `classpath` | Discover the full classpath of the project. For backwards compatibility, if the classpath phase expected but not present, then the info phase is executed instead. |
| `launcher`  | Download the relevant JUnit Jupiter Launcher (for Gradle only).                                                                                                    |
| `clean`     | Remove all previously generated classes, (coverage) reports, etc.                                                                                                  |
| `build`     | Builds the project, including test-sources.                                                                                                                        |
| `test`      | Execute the unit tests.                                                                                                                                            |
| `coverage`  | Computes coverage of the tests.                                                                                                                                    |
| `refactor`  | Applies any changes that we’ve detected can be applied automatically.                                                                                              |
| `validate`  | Execute all unit/integration tests.                                                                                                                                |

By default, Cover has pre-defined commands that it invokes in each of these phases. You can run `dcover build-debug` to see the commands for each phase.

You can customise these commands by creating a file called `DiffblueBuild.yaml` or `DiffblueBuild.yml` in the root of your project or a module. Note that by defining your own configuration file you override the default behaviour of Cover and therefore your file must specify all the interactions between Cover and your project's build system. Here is the minimum configuration that will be accepted by Cover (all the blocks below are required):

{% code title="DiffblueBuild.yaml" fullWidth="false" %}

```yaml
meta:
  version: 3
  toolName: my-special-maven
cmd:
  windows:
    - mvn.cmd
  linux:
    - mvn
  macos:
    - mvn
global:
  timeout: PT1M
phase:
  info: ~
  classpath: ~
  launcher: ~
  clean: ~
  build: ~
  test: ~
  coverage: ~
  refactor: ~
  validate: ~
```

{% endcode %}

This example, while valid, won’t work as it doesn't execute any commands (all phases are a no-op `~`). See the [Quick guide](/features/cover-cli/project-configuration/configuring-cover-to-work-with-your-projects-build-system/quick-guide.md) to learn how to set up the most common customisations. For more information about the structure of the `DiffblueBuild.yaml` file, see [Configuration file in detail](/features/cover-cli/project-configuration/configuring-cover-to-work-with-your-projects-build-system/configuration-file-in-detail.md). Finally, to see the default configuration used by Cover out of the box, see [Default configuration](/features/cover-cli/project-configuration/configuring-cover-to-work-with-your-projects-build-system/default-configuration.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cover-docs-preview.diffblue.com/features/cover-cli/project-configuration/configuring-cover-to-work-with-your-projects-build-system.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
