Gradle plugin
Edit pageLast modified: 16 January 2025The Gradle Qodana plugin provides the Gradle interface for running code inspections provided by Qodana. To start, apply the Gradle plugin org.jetbrains.qodana
in the Gradle configuration file.
Add the following to the build.gradle
configuration file.
plugins {
id "org.jetbrains.qodana" version "<plugin-version>"
}
Add the following to the build.gradle.kts
configuration file:
plugins {
id("org.jetbrains.qodana") version "<plugin-version>"
}
note
tip
For details on working with Gradle in IntelliJ IDEA, see the IntelliJ IDEA Gradle documentation.
qodana { }
extension configuration
Properties available for configuration in the qodana { }
top-level configuration closure:
Name | Description | Type | Default Value |
---|---|---|---|
| Path to the project folder to analyze. |
|
|
| Path to the directory to store task results. |
|
|
| Path to the directory to store the generated report. |
|
|
Gradle Qodana Tasks
qodanaScan
Start Qodana in the project directory.
The task relies on the qodana { }
extension configuration. However, it is also controlled by provided arguments
.
Example
Add this to your Gradle configuration file:
Groovy –
build.gradle
plugins { // applies Gradle Qodana plugin to use it in project id "org.jetbrains.qodana" version "..." } qodana { // by default result path is $projectPath/build/results resultsPath = "some/output/path" } qodanaScan { arguments = ["--fail-threshold", "0"] }
Kotlin –
build.gradle.kts
plugins { // applies Gradle Qodana plugin to use it in project id("org.jetbrains.qodana") version "..." } qodana { // by default result path is $projectPath/build/results resultsPath.set("some/output/path") } qodanaScan { resultsPath.set("some/output/path") arguments.set(listOf("--fail-threshold", "0")) }
tip
Note: Docker requires at least 4GB of memory. Set it in the Docker
Preferences > Resources > Memory
section.
Now you can run analyzes with qodanaScan
Gradle task:
gradle qodanaScan
// or
./gradlew qodanaScan
A complete guide for options and configuration of arguments
parameters can be found on Qodana CLI docs page.
Thanks for your feedback!