Skip to content

Commit

Permalink
Add maven-publish.gradle to enable publishing to GitLab
Browse files Browse the repository at this point in the history
  • Loading branch information
msgilligan committed Sep 3, 2024
1 parent d06adcc commit 8c14c1b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
10 changes: 9 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ plugins {
id 'com.github.hierynomus.license' version '0.16.1' apply false
}

subprojects {
// Projects to be published with maven-publish
ext.publishedProjects = ['secp-api', 'secp-ffm', 'secp-bouncy']

subprojects { sub ->
apply plugin: 'java'
apply plugin: 'groovy'
//apply plugin: 'test-report-aggregation'
Expand All @@ -23,6 +26,10 @@ subprojects {
}

java {
if (sub.name in publishedProjects) {
withJavadocJar()
}
withSourcesJar()
toolchain {
// `languageVersion` is used to configure the "Java Toolchain" used for the build. This includes `javac`,
// `jlink`, and the `jpackage` tool.
Expand All @@ -45,4 +52,5 @@ subprojects {
}

apply from: 'gradle/licenseCheck.gradle'
apply from: 'gradle/maven-publish.gradle'

29 changes: 29 additions & 0 deletions gradle/maven-publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
subprojects { sub ->

if (sub.name in publishedProjects) {
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)
}
}
}
}
}
}

0 comments on commit 8c14c1b

Please sign in to comment.