Apply plugin in precompile script gradle kotlin

hi i’m trying to apply precompile script gradle.kts file ( gradle.kts script is put in buildSrc/main/java . everything work normally except that i can not add a plugin with version. for example my test.gradle.kts

plugins {
  id("io.gitlab.arturbosch.detekt") version "1.1.1"

but alway got the error

Invalid plugin request [id: 'io.gitlab.arturbosch.detekt', version: '1.1.1']. Plugin requests from precompiled scripts must not include a version number. Please remove the version from the offending request and make sure the module containing the requested plugin 'io.gitlab.arturbosch.detekt' is an implementation dependency of project ':buildSrc'.

and also i cannot the class to configure extension

for example this normally configuration is not working


how can we specify plugin version in precompile script ? and how can we configure the plugin thanks.

I am also facing the same issue
did any one have soluation

The error message is pretty clear, isn’t it?
Which part do you not understand?