Skip to content

Commit

Permalink
[ACC-1443] Prepare for publication to maven central
Browse files Browse the repository at this point in the history
  • Loading branch information
thijslemmens committed Jun 14, 2024
1 parent 42b21bc commit b7d6c1d
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ plugins {
id 'org.sonarqube'
}

apply from: "${rootDir}/gradle/publish.gradle"

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
withSourcesJar()
withJavadocJar()
}

jacocoTestReport {
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
group=com.contentgrid.hal
description=HAL and HAL-FORMS client
73 changes: 73 additions & 0 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

publishing {
publications {

all {
pom {
url = 'https://github.com/xenit-eu/java-hal-client'
name = project.name
description = project.description

scm {
connection = 'scm:git:git@github.com:xenit-eu/java-hal-client.git'
developerConnection = 'scm:git:git@github.com:xenit-eu/java-hal-client.git'
url = 'https://github.com/xenit-eu/java-hal-client.git'
}

developers {
developer {
name = "XeniT"
organization = "XeniT Solutions NV"
}
}

licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0'
}
}
}
}

library(MavenPublication) {
from components.java

versionMapping {
usage("java-api") {
fromResolutionResult()
}
usage("java-runtime") {
fromResolutionResult()
}
}
}
}

repositories {
if ("${project.version}".endsWith('-SNAPSHOT')) {
sonatypeSnapshots {
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
credentials {
username = project.findProperty('sonatype_username')
password = project.findProperty('sonatype_password')
}
}
} else {
sonatypeMavenCentral {
url = "https://s01.oss.sonatype.org/service/local/"
credentials {
username = project.findProperty('sonatype_username')
password = project.findProperty('sonatype_password')
}
}
}
}

}

tasks.named('check').configure {
dependsOn('checkMavenCentralRequirements')
}

0 comments on commit b7d6c1d

Please sign in to comment.