Skip to content

Task Failures with gradle LockMode.STRICT #2906

@felinira

Description

@felinira

I enabled gradle dependency locking by following https://docs.gradle.org/current/userguide/dependency_locking.html

When setting the following in the root configuration:

dependencyLocking {
    lockAllConfigurations()
    lockMode = LockMode.STRICT
}

I get failures when running spotlessCheck and spotlessApply:

> Task :spotlessKotlin FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':spotlessKotlin'.
> You need to add a repository containing the '[com.pinterest.ktlint:ktlint-cli:1.8.0]' artifact in 'build.gradle'.
  E.g.: 'repositories { mavenCentral() }'

A workaround is to override the lockMode in the spotless configuration:

spotless {
    configurations.compileClasspath {
        dependencyLocking {
            lockMode = LockMode.LENIENT
        }
    }
}

But it would be nice if it were possible to lock the ktlint version and allow running with LockMode.STRICT all the way :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions