Detekt: [V1.6.0 -> V1.7.4] Error reading configuration file, java.util.zip.ZipException: invalid code lengths set.

Created on 6 Apr 2020  路  4Comments  路  Source: detekt/detekt

Expected Behavior

Detekt gradle task finish successfully when there are changes to custom RuleProvider or Rule.

Observed Behavior

Detekt gralde task failed with the following stack.

Caused by: java.util.ServiceConfigurationError: io.gitlab.arturbosch.detekt.api.RuleSetProvider: Error reading configuration file
        at io.gitlab.arturbosch.detekt.core.RuleSetLocator.load(RuleSetLocator.kt:29)
        at io.gitlab.arturbosch.detekt.cli.config.DefaultPropertiesConfigValidator$validate$1.invoke(DefaultPropertiesConfigValidator.kt:20)
        at io.gitlab.arturbosch.detekt.cli.config.DefaultPropertiesConfigValidator.validate(DefaultPropertiesConfigValidator.kt:27)
        at io.gitlab.arturbosch.detekt.cli.config.ConfigValidatorsKt.checkConfiguration(ConfigValidators.kt:15)
        at io.gitlab.arturbosch.detekt.cli.runners.Runner.execute(Runner.kt:31)
        at io.gitlab.arturbosch.detekt.invoke.DefaultCliInvoker.invokeCli(DetektInvoker.kt:51)
        ... 89 more
Caused by: java.util.zip.ZipException: invalid code lengths set
        ... 95 more

Steps to Reproduce

1) Remove a rule from a RuleProvider
2) Run gradle detekt task.

Your Environment

  • Version of detekt used: v1.7.4
  • Version of Gradle used (if applicable): v5.6.4
  • Operating System and version: Mac OSX 10.14 Mojave and Arch 5.5.4-arch1-1
api bug build regression

Most helpful comment

This happens due to classloader caching of the newer Gradle plugins (1.7.0+).
What you can do is to stop all daemons with gradle --stop and restart with a fresh classloader or start builds without a daemon gradle build --no-daemon.

I think we should introduce an additional timestamp comparision ...

All 4 comments

More reproduction:

1) Run ./gradlew detekt on current master
2) Remove for example the rule ChainWrapping from file io.gitlab.arturbosch.detekt.formatting.KtLintMultiRule
3) Rerun the gradle task

This happens due to classloader caching of the newer Gradle plugins (1.7.0+).
What you can do is to stop all daemons with gradle --stop and restart with a fresh classloader or start builds without a daemon gradle build --no-daemon.

I think we should introduce an additional timestamp comparision ...

Yup, stopping all the gradle daemon seems to be a good temporary solution. :+1:

I've added the regression and api tag as this hurts all extension authors.
So imo this is now a blocker.
I will experiment with simple/cheap hashes.

Was this page helpful?
0 / 5 - 0 ratings