diff --git a/account/build.gradle.kts b/account/build.gradle.kts index 7e46d910d9..f95fcd9db0 100644 --- a/account/build.gradle.kts +++ b/account/build.gradle.kts @@ -1,9 +1,10 @@ plugins { id("bisq.java-library") id("bisq.protobuf") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } +version = rootProject.version + dependencies { implementation(project(":i18n")) implementation(project(":persistence")) diff --git a/application/build.gradle.kts b/application/build.gradle.kts index 2b924b9bdf..66c158b41b 100644 --- a/application/build.gradle.kts +++ b/application/build.gradle.kts @@ -1,6 +1,5 @@ plugins { id("bisq.java-library") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } dependencies { diff --git a/bonded-roles/build.gradle.kts b/bonded-roles/build.gradle.kts index e1afe4aa5b..48c4ec89a5 100644 --- a/bonded-roles/build.gradle.kts +++ b/bonded-roles/build.gradle.kts @@ -1,7 +1,6 @@ plugins { id("bisq.java-library") id("bisq.protobuf") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } dependencies { diff --git a/build-logic/maven-publisher/src/main/kotlin/bisq/gradle/maven_publisher/LocalMavenPublishPlugin.kt b/build-logic/maven-publisher/src/main/kotlin/bisq/gradle/maven_publisher/LocalMavenPublishPlugin.kt index deb038d228..1e06fba784 100644 --- a/build-logic/maven-publisher/src/main/kotlin/bisq/gradle/maven_publisher/LocalMavenPublishPlugin.kt +++ b/build-logic/maven-publisher/src/main/kotlin/bisq/gradle/maven_publisher/LocalMavenPublishPlugin.kt @@ -75,8 +75,9 @@ class LocalMavenPublishPlugin : Plugin { project.extensions.configure("publishing") { publications { // val publicationName = if (group == DEFAULT_GROUP) "mavenJava" else "mavenJava_${group}" - val publicationName = "mavenJava" - create(publicationName, MavenPublication::class) { + var publicationName = "mavenJava" + var existingPublication = findByName(publicationName) ?: create(publicationName, MavenPublication::class) + (existingPublication as MavenPublication).apply { from(project.components["java"]) // Adjust if publishing other types (like Kotlin) artifactId = project.name groupId = group @@ -85,7 +86,9 @@ class LocalMavenPublishPlugin : Plugin { setupPublication(project, group, protoSourcesJar) } if (group != DEFAULT_GROUP) { - create("mavenJava_bisqAlias", MavenPublication::class) { + publicationName = "mavenJava_bisqAlias" + existingPublication = findByName(publicationName) ?: create(publicationName, MavenPublication::class) + (existingPublication as MavenPublication).apply { groupId = "bisq" artifactId = project.name version = rootVersion @@ -146,12 +149,16 @@ class LocalMavenPublishPlugin : Plugin { } private fun loadRootVersion(project: Project) { val rootPropertiesFile = File(getRootGradlePropertiesFile(project), "gradle.properties") - val rootProperties = Properties() - if (rootPropertiesFile.exists()) { - rootProperties.load(rootPropertiesFile.inputStream()) - } + if (project.version != "unspecified") { + rootVersion = project.version as String + } else { + val rootProperties = Properties() + if (rootPropertiesFile.exists()) { + rootProperties.load(rootPropertiesFile.inputStream()) + } - rootVersion = rootProperties.getProperty("version", "unspecified") + rootVersion = rootProperties.getProperty("version", "unspecified") + } } private fun getRootGradlePropertiesFile(project: Project): File { diff --git a/build.gradle.kts b/build.gradle.kts index 0517721842..c47809a39f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,18 +1,8 @@ plugins { java - id("maven-publish") // for jitpack + id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } -group = "bisq" -version = project.version -//sourceCompatibility = 1.8 // java 8 -//targetCompatibility = 1.8 - -//java { -// withJavadocJar() -// withSourcesJar() -//} - tasks.register("buildAll") { group = "build" description = "Build the entire project leaving it ready to work with." diff --git a/chat/build.gradle.kts b/chat/build.gradle.kts index c93c5a62d6..183c731f5b 100644 --- a/chat/build.gradle.kts +++ b/chat/build.gradle.kts @@ -1,7 +1,6 @@ plugins { id("bisq.java-library") id("bisq.protobuf") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } dependencies { diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 1f0d015ba1..f86eee58aa 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -3,7 +3,6 @@ plugins { id("bisq.java-conventions") id("bisq.java-integration-tests") id("bisq.protobuf") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } diff --git a/contract/build.gradle.kts b/contract/build.gradle.kts index 04838392ee..649a870312 100644 --- a/contract/build.gradle.kts +++ b/contract/build.gradle.kts @@ -1,7 +1,6 @@ plugins { id("bisq.java-library") id("bisq.protobuf") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } dependencies { diff --git a/i18n/build.gradle.kts b/i18n/build.gradle.kts index 1c9f0efa7e..f33fdc76e2 100644 --- a/i18n/build.gradle.kts +++ b/i18n/build.gradle.kts @@ -1,4 +1,3 @@ plugins { id("bisq.java-library") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } diff --git a/identity/build.gradle.kts b/identity/build.gradle.kts index 5be7810ea4..084d0eeb67 100644 --- a/identity/build.gradle.kts +++ b/identity/build.gradle.kts @@ -1,7 +1,6 @@ plugins { id("bisq.java-library") id("bisq.protobuf") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } dependencies { diff --git a/offer/build.gradle.kts b/offer/build.gradle.kts index e7f1f402f5..5576db7fb3 100644 --- a/offer/build.gradle.kts +++ b/offer/build.gradle.kts @@ -1,7 +1,6 @@ plugins { id("bisq.java-library") id("bisq.protobuf") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } dependencies { diff --git a/persistence/build.gradle.kts b/persistence/build.gradle.kts index a149482b15..a11c8d071c 100644 --- a/persistence/build.gradle.kts +++ b/persistence/build.gradle.kts @@ -1,5 +1,4 @@ plugins { id("bisq.java-library") id("bisq.protobuf") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } diff --git a/presentation/build.gradle.kts b/presentation/build.gradle.kts index cef7aa5b17..7814c01658 100644 --- a/presentation/build.gradle.kts +++ b/presentation/build.gradle.kts @@ -1,7 +1,6 @@ plugins { id("bisq.java-library") id("bisq.protobuf") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } dependencies { diff --git a/security/build.gradle.kts b/security/build.gradle.kts index e118f3ac1a..0d542cdd5d 100644 --- a/security/build.gradle.kts +++ b/security/build.gradle.kts @@ -1,7 +1,6 @@ plugins { id("bisq.java-library") id("bisq.protobuf") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } dependencies { diff --git a/settings/build.gradle.kts b/settings/build.gradle.kts index e2522febd6..d3545ed158 100644 --- a/settings/build.gradle.kts +++ b/settings/build.gradle.kts @@ -1,7 +1,6 @@ plugins { id("bisq.java-library") id("bisq.protobuf") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } dependencies { diff --git a/support/build.gradle.kts b/support/build.gradle.kts index fd67e95cb1..ef9cd63d7d 100644 --- a/support/build.gradle.kts +++ b/support/build.gradle.kts @@ -1,7 +1,6 @@ plugins { id("bisq.java-library") id("bisq.protobuf") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } dependencies { diff --git a/trade/build.gradle.kts b/trade/build.gradle.kts index fb5ad0a63c..2bd01b8f11 100644 --- a/trade/build.gradle.kts +++ b/trade/build.gradle.kts @@ -1,7 +1,6 @@ plugins { id("bisq.java-library") id("bisq.protobuf") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } dependencies { diff --git a/user/build.gradle.kts b/user/build.gradle.kts index de93fa7d28..6cd94f77c7 100644 --- a/user/build.gradle.kts +++ b/user/build.gradle.kts @@ -1,7 +1,6 @@ plugins { id("bisq.java-library") id("bisq.protobuf") - id("bisq.gradle.maven_publisher.LocalMavenPublishPlugin") } dependencies {