In my project I'm creating my own instance of `Kot...
# javascript
r
In my project I'm creating my own instance of
KotlinWebpack
task (via gradle plugin). I'm testing Kotlin
2.2.0-Beta1
and it doesn't work anymore.
I have this error:
Copy code
> Failed to notify project evaluation listener.
   > Cannot query the value of task ':examples:realworld:jsBrowserProductionWebpackSSR' property 'versions$kotlin_gradle_plugin_common' because it has no value available.
But there are more changes to this task including
Extending this class is deprecated. Scheduled for removal in Kotlin 2.4.
.
How can I create my own
KotlinWebpack
task? I need to provide different
webpack.config.d
directory and different
outputDirectory
t
cc @Ilya Goncharov [JB]
r
I've managed to workaround this issue with a horrible JVM reflection ;-/
Copy code
tasks.getByName<KotlinWebpack>("jsBrowserProductionWebpackSSR").apply {
    val method = this.javaClass.declaredMethods.find { it.name == "setVersions\$kotlin_gradle_plugin_common" }
    val prop = project.objects.property<NpmVersions>()
    prop.set(NpmVersions())
    method?.invoke(this, prop)
    // ...
}
I would definitely prefer another solution.
i
Hi, thanks! I see your case, could you please submit an issue?
By the way, if you have your plugin depending on
kotlin-gradle-plugin
, you could declare
kotlin-gradle-plugin
as a friend dependency. But there are no such good ways to declare the specific dependency as a friend, so some hacks are necessary anyway