From 2935d914ff242be5c834c2e8bdc7dea5a355839d Mon Sep 17 00:00:00 2001 From: Sean Gilligan Date: Tue, 3 Sep 2024 10:53:18 -0700 Subject: [PATCH] Add maven-publish.gradle to enable publishing to GitLab --- build.gradle | 9 ++++++++- gradle/maven-publish.gradle | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gradle/maven-publish.gradle diff --git a/build.gradle b/build.gradle index 2575106..0cd781a 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,9 @@ plugins { id 'com.github.hierynomus.license' version '0.16.1' apply false } -subprojects { +ext.publishedProjects = ['secp-api', 'secp-ffm', 'secp-bouncy'] + +subprojects { sub -> apply plugin: 'java' apply plugin: 'groovy' //apply plugin: 'test-report-aggregation' @@ -23,6 +25,10 @@ subprojects { } java { + if (sub.name in publishedProjects) { + withJavadocJar() + } + withSourcesJar() sourceCompatibility = JavaVersion.toVersion("22") targetCompatibility = JavaVersion.toVersion("22") toolchain { @@ -47,4 +53,5 @@ subprojects { } apply from: 'gradle/licenseCheck.gradle' +apply from: 'gradle/maven-publish.gradle' diff --git a/gradle/maven-publish.gradle b/gradle/maven-publish.gradle new file mode 100644 index 0000000..b149ab7 --- /dev/null +++ b/gradle/maven-publish.gradle @@ -0,0 +1,26 @@ +subprojects { + apply plugin: 'maven-publish' + + publishing { + publications { + jar(MavenPublication) { + from components.java + } + + } + repositories { + def secpJdkGitLabProjectId = "55956336" + maven { + url "https://gitlab.com/api/v4/projects/${secpJdkGitLabProjectId}/packages/maven" + name "GitLab" + credentials(HttpHeaderCredentials) { + name = 'Private-Token' + value = project.findProperty("gitLabMavenToken") + } + authentication { + header(HttpHeaderAuthentication) + } + } + } + } +}