From c85a333de933b14eb817bee5acb54ba40a64ea9c Mon Sep 17 00:00:00 2001 From: thetaqx Date: Sun, 4 Feb 2024 11:21:00 +0300 Subject: [PATCH] Update buildscripts to support publishing to Maven --- build.gradle | 46 ++++++++++++++++++++++++++++++++---- stomp-client-ws/build.gradle | 2 +- stomp/build.gradle | 2 +- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 5486822..357eff3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,47 @@ group 'eu.mivrenik' version '1.0' -apply plugin: 'java' -apply plugin: 'java-library' - -sourceCompatibility = 1.7 - repositories { mavenCentral() } + +def creds = new Properties() +def credsFile = file("credentials.properties") +if (credsFile.exists()) + credsFile.withInputStream { creds.load(it) } + +allprojects { + apply plugin: 'java' + apply plugin: 'maven-publish' + + sourceCompatibility = 1.7 + + publishing { + repositories { + maven { + name = "funqx gitea" + url = uri("https://git.funqx.org/api/packages/World2Join/maven") + + credentials(HttpHeaderCredentials) { + name = "Authorization" + value = "token ${creds.getProperty("gitea.token")}" + } + + authentication { + header(HttpHeaderAuthentication) + } + } + } + } +} + +subprojects { + publishing { + publications { + maven(MavenPublication) { + + from components.java + } + } + } +} \ No newline at end of file diff --git a/stomp-client-ws/build.gradle b/stomp-client-ws/build.gradle index 6388678..95a1e61 100644 --- a/stomp-client-ws/build.gradle +++ b/stomp-client-ws/build.gradle @@ -13,4 +13,4 @@ repositories { dependencies { api project(':stomp') api 'org.java-websocket:Java-WebSocket:1.3.6' -} +} \ No newline at end of file diff --git a/stomp/build.gradle b/stomp/build.gradle index 0e47bae..5966dc9 100644 --- a/stomp/build.gradle +++ b/stomp/build.gradle @@ -7,4 +7,4 @@ sourceCompatibility = 1.7 repositories { mavenCentral() -} +} \ No newline at end of file