Hi, I have developed a custom gradle plugin. All w...
# community-support
d
Hi, I have developed a custom gradle plugin. All works fine when published locally. When I publish it to the gradle-plugin-portal, it seems I cannot consume it. The plugin is available in the portal, (first version published back in 2021), recent version published today. The consuming project fails with
Copy code
Could not resolve all files for configuration
...
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find <my plugin>
and seems to be searching in maven central (https://repo.maven.apache.org/maven2) I tried adding repositories to the pluginManagement
Copy code
pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
but that does not seem to help! any ideas...what have I forgotten, I'm sure I used to use this custom plugin without any issues! thanks
v
Can you show the full error, or optimally a build
--scan
URL if possible?
d
Copy code
Execution failed for task ':ValueClassExtensionNotWorkingInJavascript:compileKotlinJs'.
> Could not resolve all files for configuration ':ValueClassExtensionNotWorkingInJavascript:kotlinCompilerPluginClasspathJsMain'.
   > Could not find net.akehurst.kotlin.gradle.plugin:exportPublic:2.0.20-rc1.
     Searched in the following locations:
       - <https://repo.maven.apache.org/maven2/net/akehurst/kotlin/gradle/plugin/exportPublic/2.0.20-rc1/exportPublic-2.0.20-rc1.pom>
     Required by:
         project :ValueClassExtensionNotWorkingInJavascript
v
It does not fail when applying the plugin but later. You probably somehow add the plugin somehow as production dependency and there you only defined maven central.
Yep, in your
KotlinCompilerPluginSupportPlugin
you define your Gradle plugin as plugin artifact. But the Kotlin compiler plugins are resolved using the project repositories, not the plugin repositories. And there your plugin is not found as you only published it to the Gradle Plugin Portal.
d
ah.... so I have to publish a Kotlin compiler plugin to maven central as well as to the gradle-plugin-portal is that correct ? (I don't remember doing that before, but maybe I forget)
v
Seems so. Or the consumers have to add the GPP as repository.
Or you split the Gradle plugin part from the Kotlin Compiler Plugin part and deploy them as separate artifacts, one to MC, one to GPP
d
Or the consumers have to add the GPP as repository.
how would one do that ? what is the URL to the GPP where the artefacts are contained ?
v
gradlePluginPortal()
just like
mavenCentral()
d
ah..doh ! of course
yes, that fixes it many many thanks for the help
Copy code
repositories {
    gradlePluginPortal()
}
👌 1