Is there any way to avoid the warning when registe...
# community-support
s
Is there any way to avoid the warning when registering a feature variant?
Copy code
java {
    registerFeature("api") {
        usingSourceSet(sourceSets.create("api"))
    }
}
I'm following the documentation, but getting a warning:
Copy code
> Configure project :MyPlugin
The resolvable usage is already allowed on configuration ':MyPlugin:apiRuntimeClasspath'. This behavior has been deprecated. This behavior is scheduled to be removed in Gradle 9.0. Remove the call to setCanBeResolved(true), it has no effect. Consult the upgrading guide for further information: <https://docs.gradle.org/8.6/userguide/upgrading_version_8.html#redundant_configuration_usage_activation>
	at build_9r8pzu5e0o5ivhas2a4kdj4xn$_run_closure1$_closure4.doCall$original(/Users/sergey/Projects/plugins/MyPlugin/build.gradle:9)
	(Run with --stacktrace to get the full stack trace of this deprecation warning.)
This might have something to do with Kotlin plugin being applied.
c
This is using some incubating features, and I don't understand your warning, but try this (obviously this is copy/paste from my code)
Copy code
val demoServer by sourceSets.creating

java {
  registerFeature("demoServer") {
    usingSourceSet(demoServer)
  }
}

val demoServerImplementation by configurations.existing
val demoServerRuntimeOnly by configurations.existing
although, I just read your stack further, looks like you're using groovy... so my kotlin won't work
v
I'd say you are right that Kotlin is the culprit and you should report it to Jetbrains. If I just copy your snippet, no warning appears, if I apply Kotlin/JVM plugin 1.9.23 I also get that warning and if you enable
--stacktrace
you also see it comes from Kotlin Plugin.
a
This might have something to do with Kotlin plugin being applied.
That's probably correct. KGP sometimes modifies the Java plugin's configurations, which now triggers a Gradle deprecation. https://youtrack.jetbrains.com/issue/KT-66542
s
@Adam thanks for the link! I will leave a comment there and keep an eye on the issue
👍 1