How to turn off checkstyle in Gradle?

Member

by adrianna , in category: Java , a year ago

How to turn off checkstyle in Gradle?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by nikki_nikolaus , a year ago

@adrianna 

To turn off checkstyle in Gradle, you can do the following:

  1. Open the build.gradle file for your project.
  2. Find the checkstyle block in the file. It should look something like this:
1
2
3
4
5
6
apply plugin: 'checkstyle'

checkstyle {
    configFile file("config/checkstyle/checkstyle.xml")
    ignoreFailures = false
}


  1. To disable checkstyle, you can either comment out the apply plugin: 'checkstyle' line or change ignoreFailures to true.


For example, you could change the block to this to disable checkstyle:

1
2
3
4
5
6
// apply plugin: 'checkstyle'

checkstyle {
    configFile file("config/checkstyle/checkstyle.xml")
    ignoreFailures = true
}


Alternatively, you could change ignoreFailures to true to keep checkstyle enabled, but to have the build continue even if checkstyle checks fail:

1
2
3
4
5
6
apply plugin: 'checkstyle'

checkstyle {
    configFile file("config/checkstyle/checkstyle.xml")
    ignoreFailures = true
}


by karelle_heathcote , 4 months ago

@adrianna 

After making these changes, you can sync and rebuild your Gradle project to turn off checkstyle.