admin管理员组文章数量:1356876
I have two Gradle projects, one application and one Gradle plugin. The Gradle plugin applies multiple other plugins to a target project.
To do this I first include the other plugins as dependencies in the plugin project to get them on the classpath like so:
dependencies {
implementation(".jetbrains.kotlin:kotlin-gradle-plugin:2.1.20")
implementation(".jetbrains.kotlin.plugin.serialization:.jetbrains.kotlin.plugin.serialization.gradle.plugin:2.1.20")
}
Then I apply them to the target project in the plugin class:
class MyPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply(".jetbrains.kotlin.multiplatform")
apply(".jetbrains.kotlin.plugin.serialization")
}
}
}
}
This has worked fine until I tried to also apply the Android application plugin (which exists in Google's maven repo and not Gradle's plugin repo):
dependencies {
implementation("com.android.application:com.android.application.gradle.plugin:8.9.1")
}
Gradle fails to find it even though I've defined the google()
repository in the plugin project's settings.gradle.kts
.
For some reason, Gradle is only looking for these dependencies in the Gradle plugin portal, regardless of what repositories I define.
I've found that it does work if I define the google()
repository in the target project like so:
pluginManagement {
repositories {
gradlePluginPortal()
google()
}
}
It doesn't make sense to me that the target project has to add a repository that the plugin uses to pull in internal dependencies.
Is there a way to tell the plugin project to look for these dependencies in the right repo without needing each consuming project to add google()
to their plugin repositories?
本文标签: Gradle Plugindefine repositories for internal dependenciesStack Overflow
版权声明:本文标题:Gradle Plugin, define repositories for internal dependencies - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743967910a2570226.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论