Knowledge Base > JCover CLI > Gradle projects
Gradle projects
Compiling the application
The application must be compiled as JCover analyses both the source and the Java bytecode.
To build the project or module:
$ gradle build
or, if there is a Gradle wrapper script:
$ ./gradlew build
(Linux/macOS)
> gradlew build
(Windows)
To run JCover:
$ jcover --gradle --test-verification --class-suffix DiffblueTest
Other Gradle options
To force JCover to use Gradle:
--gradle
To use a Gradle settings file (substituting the actual file name):
--settings file-name
To specify the Gradle project/submodule (substituting the actual project/submodule name):
--project name
To create a configuration file:
$ jcover --gradle-config
(This creates jcover.config in the run directory, containing jcover parameters for the module under test. JCover then uses these options when run against a specific class.)
To create tests for a specific Java class:
$ jcover classname
(This creates tests, displayed on the screen, for the given classname. Note: This requires that you have previously run jcover --gradle-config
).