Skip to content

Conflict with Gradle kotlin-dsl plugin #141

@cslee00

Description

@cslee00

When writing Gradle plugins that use Kotlin DSL there is a conflict w/ resolution-rules, resulting in this error:

Cannot change attributes of dependency configuration ':apiElements-published' after it has been resolved

The issue is related to the order of the plugins - changing kotlin-dsl to be following resolution-rules works. Considering this a workaround (at best) as it may not always be an option and indicates some underlying fragility.

This minimal build script reproduces the issue (build.gradle.kts)

plugins {
    // if kotlin-dsl plugin is loaded first that results in this error:
    //   Cannot change attributes of dependency configuration ':apiElements-published' after it has been resolved

    // flipping the order is works as expected
    `kotlin-dsl`

    id("nebula.resolution-rules") version "9.0.0"
}

repositories {
    mavenCentral()
}

dependencies {
    resolutionRules("com.netflix.nebula:gradle-resolution-rules:latest.release")
}

Reproducible on Gradle 7.1.1 thru 7.3.2 (earlier versions were not tested).
Reproducible on resolution-rules v9.0.0 (v8.0.0 works)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions