rob_d
10/05/2024, 1:53 AM"com.vanniktech.maven.publish"
plugin in a multi-module project where each of the modules has publishing information specified in the build.gradle file. For example:
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.KotlinMultiplatform
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.vanniktechMaven)
alias(libs.plugins.dokka)
}
publishing {
repositories {
maven {
name = "local"
url = uri(System.getProperty("user.home") + "/.m2/repository")
}
maven {
name = "githubPackages"
url = uri("....")
credentials(PasswordCredentials::class)
}
}
}
mavenPublishing {
configure(
.......
)
)
// Define coordinates for the published artifact
coordinates(
groupId = "com.example.lib",
artifactId = "example",
version = "1.0.0"
)
// Configure POM metadata for the published artifact
pom {
name.set("....")
description.set("....")
inceptionYear.set("...")
url.set("....")
// Specify developers information
developers {
developer {
id.set("....")
name.set(".....")
}
}
Is there a good way to centralize all of the configuration in one place while still allowing to set the pom and coordinate values individually for each module?
Edit: I explored the build-logic module option with a convention plugin but couldn't make it work for what I believe where limitations with the plugin itself, so that's probably not an option.Vampire
10/05/2024, 3:18 AMlocal
repo can be simplified to mavenLocal()
• Your local
repo can be removed, as you always have publish...ToMavenLocal
automatically
• You should avoid using Maven Local wherever possible and if you really really really need it, restrict it as far as you can with content filters or you make your builds flaky and slowmbonnin
10/05/2024, 8:44 AMmavenPublish
and that only takes the per-module settings as input