question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plugin not working with Gradle 7 and checkstyle

See original GitHub issue

I have been trying to upgrade some applications that use this plugin to Gradle 7 but it seems there is something missing or wrong. I see that you have released version 0.0.6 that is compatible with Gradle 7, but it is not working for me.

I have a multi-project build structure although for this simple project I only have one module, but for my real application I have more modules. I’m not sure if this will affect or not to the issue.

To reproduce the issue

  • git clone https://github.com/ilopmar/no-http-app-gradle
  • cd no-http-app-gradle
  • ./gradlew checkstyleNohttp

The task fails with:

Execution failed for task ':checkstyleNohttp'.
> Cannot add config_loc to checkstyle.configProperties. Please configure the configDirectory on the checkstyle task instead.

I’ve tried setting the following even if it’s not necessary because that is the default directory according to https://docs.gradle.org/current/dsl/org.gradle.api.plugins.quality.CheckstyleExtension.html#org.gradle.api.plugins.quality.CheckstyleExtension:configDirectory

checkstyle {
    ...
    configDirectory = file("${rootDir}/config/checkstyle")
    ...
}

But it doesn’t work either. Debugging the plugin I’ve seen that the path is set correctly:

image

Another thing I’ve tried is setting that to another directory that doesn’t exist like:

checkstyle {
    ...
    configDirectory = file("${rootDir}/config/checkstyle_foo")
    ...
}

That fails as expected with:

  - Type 'Checkstyle' property 'configDirectory' specifies directory '/home/ivan/workspaces/no-http-app-gradle/config/checkstyle_foo' which doesn't exist.

And then if I rename the config/checkstyle directory to config/checkstyle_foo it fails with the first error I showed.

If in this same project I rollback the wrapper to 6.8.3 it works as expected.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
rwinchcommented, Apr 13, 2021

@ilopmar Thanks for the report and the project to reproduce the issue.

@marcphilipp I don’t suppose you are able to look at this since you fixed the original issue?

1reaction
ilopmarcommented, Apr 30, 2021

Thanks @rwinch for the new release! 💯

Read more comments on GitHub >

github_iconTop Results From Across the Web

Checkstyle 10.3.1 won't run on Gradle 7.5 - Stack Overflow
This is Checkstyle's rather poor way of telling you there is something wrong with your configuration file ( checkstyle.xml ).
Read more >
The Checkstyle Plugin - Gradle User Manual
The plugin adds a number of tasks to the project that perform the quality checks. You can execute the checks by running gradle...
Read more >
How does the Checkstyle plugin update work from Gradle 6.8 ...
I'm upgrading my gradle from 6.8.2 to 7.1.1. The checkstyle plugin no longer supports configDir which requires a file parameter.
Read more >
Checkstyle plugin not compatible with checkstyle version > 6.9
Im using Gradle 2.10 and I'm trying to use he checkstyle plugin with the lastest version of checkstyle which is 6.14.1. I get...
Read more >
Checkstyle - Gradle DSL Version 7.6
Whether this task will ignore failures and continue running the build. Default with checkstyle plugin: project.checkstyle.ignoreFailures. Set ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found