# Cover Annotations

## Installation

Cover Annotations are available as a simple dependency [available via Maven Central](https://mvnrepository.com/artifact/com.diffblue.cover/cover-annotations) and are licensed under Apache License 2.0.

{% tabs %}
{% tab title="Maven" %}
In order to use the annotations in your Maven project then the Diffblue repository and `cover-annotations` dependency will need to be added into your `pom.xml`:

The dependency decleration example can be found at [available via Maven Central](https://mvnrepository.com/artifact/com.diffblue.cover/cover-annotations)

The `provided` scope means the annotations can be used when compiling your project, but don't become bundled as part of your project output. Additionally the annotations are available for use in tests and by Diffblue Cover.
{% endtab %}

{% tab title="Gradle (Groovy DSL)" %}
In order to use the annotations in your Gradle project then the Diffblue repository and `cover-annotations` dependency will need to be added into your `build.gradle`:

The dependency decleration example can be found at [available via Maven Central](https://mvnrepository.com/artifact/com.diffblue.cover/cover-annotations)

The `compileOnly` configuration means the annotations can be used when compiling your project, but don't become bundled as part of your project output. The `testImplementation` configuration means the annotations are additionally available for use in tests and by Diffblue Cover.
{% endtab %}

{% tab title="Gradle (Kotlin DSL)" %}
In order to use the annotations in your Gradle project then the Diffblue repository and `cover-annotations` dependency will need to be added into your `build.gradle.kts`:

The dependency decleration example can be found at [available via Maven Central](https://mvnrepository.com/artifact/com.diffblue.cover/cover-annotations) .

The `compileOnly` configuration means the annotations can be used when compiling your project, but don't become bundled as part of your project output. The `testImplementation` configuration means the annotations are additionally available for use in tests and by Diffblue Cover.
{% endtab %}
{% endtabs %}

Annotations placed on packages affect tests for all classes and methods under test in that package. Annotations placed on classes affect tests for that class and all its methods under test, overriding package level annotations. Annotations placed on methods affect just that method under test, overriding package and class level annotations.

The annotations will be respected by Diffblue Cover via both command line and IntelliJ Plugin. When used from the command line in conjunction with equivalent options then the command line options take priority over the annotations found.

## Version Requirements

{% hint style="warning" %}
**Merge Mode Requirement:** When using merge mode (`--merge` in CLI or `${CLASS}Test` template in the plugin), `cover-annotations` version 1.4.0 or later is required. We recommend version 1.9.0 or later for the best experience.
{% endhint %}


---

# 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.diffblue.com/features/cover-annotations.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.
