I have an existing project with `buildSrc` with pr...
# community-support
g
I have an existing project with
buildSrc
with precompiled script plugins in Groovy. May I add alongside a precompiled script plugin in Kotlin? trying to add
id 'org.gradle.kotlin.kotlin-dsl'
to the
buildSrc/build.gradle
, but I do get: > Plugin [id: 'org.gradle.kotlin.kotlin-dsl'] was not found in any of the following sources:
v
You mean
id 'kotlin-dsl'
I guess
And yes, Groovy and Kotlin precompiled script plugins should be combinable without problem
g
I also tried that
Plugin [id: 'kotlin-dsl'] was not found in any of the following sources:
v
Hm, maybe make the
buildSrc
build script Kotlin DSL?
g
that did the trick
thanks
👌 1
j
Yes it's one of the remaining weird limitations of Kotlin DSL. ``kotlin-dsl`` is the only notation that works for this "special" plugin. So in
buildSrc
you need a
build.gradle.kts
Everything else can be mixed as far as I know.
👍 1
v
Ah, (re-)found the magic incantation for applying it from Groovy DSL:
Copy code
import static org.gradle.kotlin.dsl.support.KotlinDslPluginsKt.expectedKotlinDslPluginsVersion

plugins {
   id("org.gradle.kotlin.kotlin-dsl") version "$expectedKotlinDslPluginsVersion"
}
👍 1
It is not a technically built-in plugin but is coming normally from plugin portal, just with a hard-coded version.
j
Uh thanks. TIL.
👌 1
r
Hi all. i am getting same error, I tried
Copy code
plugins {
    `kotlin-dsl`
    id("org.jetbrains.kotlin.jvm") version "1.8.20" apply false
    id("org.jetbrains.kotlin.plugin.spring") version "1.8.20" apply false
    id ("org.jetbrains.kotlin.plugin.serialization") version "1.8.20"
}
but i still get plugin not found build error
v
Which "same"? And what exactly?
r
Error is * What went wrong: Plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '2.3.3'] was not found in any of the following sources: - Gradle Core Plugins (plugin is not in 'org.gradle' namespace) - Plugin Repositories (could not resolve plugin artifact 'org.gradle.kotlin.kotlin-dslorg.gradle.kotlin.kotlin dsl.gradle.plugin2.3.3') Searched in the following repositories: Gradle Central Plugin Repository
v
That's actually not anything from this thread. Giuseppe's problem might look similar to the untrained eye, but has nothing to do with your issue at all.
In your case you try to use a plugin properly, but it is not found where it is searched for. The place where it is searched for does have the plugin though: https://plugins.gradle.org/m2/org/gradle/kotlin/kotlin-dsl/org.gradle.kotlin.kotlin-dsl.gradle.plugin/2.3.3/ This usually means either that you hit a temporary problem and Gradle just remembers that, so try to use
--refresh-dependencies
with your build command to recover. If that was not it, then the most usual other cause is, that something between you and that server is intervening, breaking it. For example a Firewall or AntiVirus intervening and breaking the download. Or you need to use a proxy to access the outworld, but did not configure Gradle to use it. You can try to add besides
--refresh-dependencies
additionally
--info
or if not enough
--debug
to maybe get some more information what exactly happens while trying to download that plugin.
r
Indeed it was a new version of corp vpn (Palo Alto Global Protect in my case) which was blocking download and plugin was not there in my local gradle cache. its resolved now. i had to use older corp vpn (Cisco AnyConnect). Thanks for confirming
👌 1