Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 20645

Exposing a custom configuration

$
0
0

Hi,

I’m using Gradle 5.6.2 and the Gradle Kotlin DSL.

In my buildSrc for a multi module project, I have declared a custom plugin which declares a custom configuration:

            val javaConvention = target.convention.getPlugin(JavaPluginConvention::class.java)
            val sourceSets = javaConvention.sourceSets
            sourceSets.create("dsl")

            val dslImplementation by target.configurations.getting

            target.dependencies {
                dslImplementation(project(":dsl-model"))
            }

            val dslJar by target.tasks.registering(Jar::class) {
                archiveClassifier.set("dsl")
                from(sourceSets["dsl"].output)
            }

            target.tasks["assemble"].dependsOn(dslJar)

This works fine for a given module and the DSL JAR is correctly built, with the correct dependencies.

However, if I want to use this module from another one in the same project:

dependencies {
   implementation(project(":dsl-module", "dsl"))
}

I get the following error on assemble:

Project :dsl-consumer declares a dependency from 
configuration 'implementation' to configuration 'dsl' 
which is not declared in the descriptor for project :dsl-module.

So I wonder, how can I declare a custom configuration in a module and somehow make it
available for consumption in other modules?

Thanks for any suggestion,
Damien


Viewing all articles
Browse latest Browse all 20645

Trending Articles