I have to create a local maven repo, so the android project will be able to build just from this local repo alone.
From the logs it seems like plugin was actually resolved. But for some reason I keep getting the following error.
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.jetbrains.kotlin.android', version: '1.9.22'] was not found in any of the following sources:
Can someone help me with that?
Short log:
Attempting to resolve component for org.jetbrains.kotlin.android:org.jetbrains.kotlin.android.gradle.plugin:1.9.22 using repositories [maven]
Loading file:/C:/Users/test/Documents/Github/Work/test/local-maven-repo/org/jetbrains/kotlin/android/org.jetbrains.kotlin.android.gradle.plugin/1.9.22/org.jetbrains.kotlin.android.gradle.plugin-1.9.22.pom
Attempting to resolve component for org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.9.22 using repositories [maven]
Loading file:/C:/Users/test/Documents/Github/Work/test/local-maven-repo/org/jetbrains/kotlin/kotlin-gradle-plugins-bom/1.9.22/kotlin-gradle-plugins-bom-1.9.22.pom
Metadata file found for module 'org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.9.22' in repository 'maven'.
Loading file:/C:/Users/test/Documents/Github/Work/test/local-maven-repo/org/jetbrains/kotlin/kotlin-gradle-plugins-bom/1.9.22/kotlin-gradle-plugins-bom-1.9.22.module
Recording module descriptor in cache: org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.9.22 [changing = false]
Using org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.9.22 from Maven repository 'maven'
Loading file:/C:/Users/test/Documents/Github/Work/test/local-maven-repo/org/jetbrains/kotlin/kotlin-gradle-plugins-bom/1.9.22/kotlin-gradle-plugins-bom-1.9.22.pom
Downloaded artifact 'kotlin-gradle-plugins-bom-1.9.22.pom (org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.9.22)' from resolver: maven
Flushing resolved configuration data in Binary store in C:\Users\test\.gradle\.tmp\gradle17832654540797845168.bin. Wrote root 2.
Build operation 'Resolve dependencies of detachedConfiguration1' completed
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.jetbrains.kotlin.android', version: '1.9.22'] 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.jetbrains.kotlin.android:org.jetbrains.kotlin.android.gradle.plugin:1.9.22')
Searched in the following repositories: maven // this is my local repo.
Here goes the full log: https://gist.github.com/romanlapa/d164589bb5f19e0416500b2f623eda7f
What I have done.
mvn dependency:resolve
.For example org.jetbrains.kotlin.android.gradle.plugin-1.9.22
has a different name by default: kotlin-gradle-plugin-1.9.22
.
My configuration.
settings.build.gradle:
pluginManagement {
repositories {
maven(uri("$rootDir/local-maven-repo"))
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven(uri("$rootDir/local-maven-repo"))
}
}
rootProject.name = "MyApplication4"
include(":app")
build.gradle.kts:
plugins {
id("com.android.application") version "8.0.0"
kotlin("android") version "1.9.22"
//id("org.jetbrains.kotlin.android") version "1.9.22"
id("maven-publish")
}
...
Gradle plugins are published in their own special Maven artifact so that Gradle can resolve them from a repo using their id alone.
This artifact has coordinates:
org.jetbrains.kotlin.android
).gradle.plugin
(eg org.jetbrains.kotlin.android.gradle.plugin
)The artifact then has a POM file with a dependency which is the artifact with the JAR containing the compiled plugin code. (You can use the POM from the actual plugin of course.)
You can either manually arrange your local repo with the plugin POM in this fashion or use this information to write a little Gradle project to republish the plugin using the Maven Publish plugin. (I would recommend the latter. Full details of how to do that is probably outside the scope of this question.)
You look to have declared the repository properly so, arranged in this way Gradle should then be able to resolve the plugin from your repo.