I want to make a local repository using publishToMavenLocal but after I using this command (even though with built-in button in IntelliJ IDEA IDE), I still cannot find the final directory (test): ".m2/com/test"
This is my build.gradle.kts file:
plugins {
kotlin("jvm") version "1.9.23"
id("maven-publish")
}
group = "com.test"
version = "0.1-SNAPSHOT"
What I have checked?
kts("maven-publish")
, I loaded Gradle changes.The messages after running "publishToMavenLocal":
2:47:56 PM: Executing 'publishToMavenLocal'...
Task :publishToMavenLocal UP-TO-DATE
BUILD SUCCESSFUL in 2s
2:47:58 PM: Execution finished 'publishToMavenLocal'.
Do you have any suggestions?
The problem was due to the lack of below 'publishing' section and kotlin id("java-library")
plugin in the project build.gradle.kts
file.
After adding the mentioned lines of code, another build command will be added to your gradle tab, which is called "publishLibraryNamePublicationToMavenLocal":
plugins {
kotlin("jvm") version "1.9.23"
id("java-library")
id("maven-publish")
}
group = "com.test"
version = "0.1-SNAPSHOT"
publishing {
publications {
create<MavenPublication>("[LIBRARY_NAME]") {
from(components["kotlin"])
}
}
}
I have used this link from Gradle documentation to find my answer.