From 2d588f99ea9b4e575713290bd7bce28ec1c2beae Mon Sep 17 00:00:00 2001 From: Toon Geens Date: Tue, 4 Oct 2022 14:32:52 +0200 Subject: [PATCH] Publish to maven central with groupId com.contentgrid.opa-java-client --- .github/workflows/ci.yml | 4 ++-- CHANGELOG.md | 12 ++++++++++- README.md | 10 ++++----- build.gradle | 22 ++++++++++++++++---- gradle.properties | 2 +- gradle/publish.gradle | 33 ++++++++++++++---------------- opa-async-java-client/build.gradle | 3 +-- rego-java/build.gradle | 3 +-- 8 files changed, 54 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e27640..fd6373c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,6 @@ jobs: env: SIGNING_PRIVATE_KEY: ${{ secrets.MAVEN_CENTRAL_GPG_KEY }} SIGNING_PASSWORD: ${{ secrets.MAVEN_CENTRAL_GPG_PASSWORD }} - ORG_GRADLE_PROJECT_sonatype_username: ${{ secrets.MAVEN_CENTRAL_USERNAME }} - ORG_GRADLE_PROJECT_sonatype_password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + ORG_GRADLE_PROJECT_sonatype_username: ${{ secrets.SONATYPE_S01_USERNAME }} + ORG_GRADLE_PROJECT_sonatype_password: ${{ secrets.SONATYPE_S01_PASSWORD }} run: ./gradlew publish \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 155f827..4e2514b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.4.0 - (Unreleased) + +Changed: +* [#7] - Moved maven group coordinates to `com.contentgrid.opa-java-client` + +Housekeeping: +* [#6] - Updated Gradle to 7.5.1 +* [#6] - Updated dependencies to Spring Boot 2.6.12 baseline + +[#6]: https://github.com/xenit-eu/opa-java-client/pull/6 +[#7]: https://github.com/xenit-eu/opa-java-client/pull/7/files ## 0.3.0 - 2021-12-09 Fixed: - * [#4] - OPA client can now serialize `java.time` classes as `input` [#4]: https://github.com/xenit-eu/opa-java-client/pull/4 diff --git a/README.md b/README.md index ef3507f..1f6262d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # OpenPolicyAgent Java Client -[![Build](https://github.com/content-cloud/opa-java-client/workflows/build/badge.svg?branch=main)](https://github.com/xenit-eu/opa-java-client/actions/workflows/ci.yml) -[![Maven Central](https://img.shields.io/maven-central/v/eu.xenit.contentcloud/opa-async-java-client?color=blue)](https://search.maven.org/search?q=a:opa-async-java-client%20g:eu.xenit.contentcloud) +[![Build](https://github.com/xenit-eu/opa-java-client/workflows/build/badge.svg?branch=main)](https://github.com/xenit-eu/opa-java-client/actions/workflows/ci.yml) +[![Maven Central](https://img.shields.io/maven-central/v/com.contentgrid.opa-java-client/opa-async-java-client?color=blue)](https://search.maven.org/search?q=a:opa-async-java-client%20g:com.contentgrid.opa-java-client) [![License](https://img.shields.io/github/license/xenit-eu/opa-java-client?color=blue)](LICENSE) An asynchronous java client library for the [OpenPolicyAgent](https://www.openpolicyagent.org/) [REST API](https://www.openpolicyagent.org/docs/latest/rest-api/). @@ -17,7 +17,7 @@ The design of the project is borrowed from [Bisnode/opa-java-client](https://git uses an async programming model instead, which makes it suitable to be used in a reactive application stack. This client library uses the JDK11+ HttpClient by default, but allows you to plug in your own http-client by providing -an implementation for the [OpaRestClient](https://github.com/xenit-eu/opa-async-java-client/blob/main/opa-async-java-client/src/main/java/eu/xenit/contentcloud/abac/opa/client/rest/OpaRestClient.java) +an implementation for the [OpaRestClient](https://github.com/xenit-eu/opa-async-java-client/blob/main/opa-async-java-client/src/main/java/com/contentgrid/opa/client/rest/OpaHttpClient.java) interface. ## Installation @@ -27,14 +27,14 @@ interface. Using Gradle: ```groovy -implementation "eu.xenit.contentcloud:opa-async-java-client:${version}" +implementation "com.contentgrid.opa-java-client:opa-async-java-client:${version}" ``` Using Maven: ```xml - eu.xenit.contentcloud + com.contentgrid.opa-java-client opa-async-java-client ${version} diff --git a/build.gradle b/build.gradle index 1bff059..4207f75 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ plugins { id "org.ajoberstar.reckon" version "0.13.0" + id "io.github.gradle-nexus.publish-plugin" version '1.1.0' } reckon { @@ -7,17 +8,30 @@ reckon { snapshotFromProp() } -configure(subprojects) { - plugins.withType(JavaPlugin) { +allprojects { + pluginManager.withPlugin('maven-publish') { + apply from: "${rootDir}/gradle/publish.gradle" + } + pluginManager.withPlugin('java') { java { + sourceCompatibility = JavaVersion.VERSION_11 withSourcesJar() withJavadocJar() } - repositories { mavenCentral() } } } -reckonTagCreate.dependsOn project.getTasksByName("check", true) +nexusPublishing { + repositories { + sonatype { + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) + + username = project.findProperty('sonatype_username') + password = project.findProperty('sonatype_password') + } + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ec8df5b..8d528a0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -group=eu.xenit.contentcloud +group=com.contentgrid.opa-java-client springBootVersion=2.6.12 lombokVersion=1.18.22 diff --git a/gradle/publish.gradle b/gradle/publish.gradle index 59dd1e9..c46bb39 100644 --- a/gradle/publish.gradle +++ b/gradle/publish.gradle @@ -3,10 +3,6 @@ apply plugin: 'signing' publishing { publications { - library(MavenPublication) { - from components.java - } - all { pom { url = 'https://github.com/xenit-eu/opa-java-client' @@ -35,22 +31,23 @@ publishing { } } } +} - - repositories { - if (version.version.isSignificant()) { - sonatypeMavenCentral { - credentials { - username = project.findProperty('sonatype_username') - password = project.findProperty('sonatype_password') - } +pluginManager.withPlugin('java') { + publishing { + publications { + library(MavenPublication) { + from components.java } - } else { - sonatypeSnapshots { - credentials { - username = project.findProperty('sonatype_username') - password = project.findProperty('sonatype_password') - } + } + } +} + +pluginManager.withPlugin('java-platform') { + publishing { + publications { + platform(MavenPublication) { + from components.javaPlatform } } } diff --git a/opa-async-java-client/build.gradle b/opa-async-java-client/build.gradle index 2891dc4..c521658 100644 --- a/opa-async-java-client/build.gradle +++ b/opa-async-java-client/build.gradle @@ -1,9 +1,8 @@ plugins { id 'java-library' + id 'maven-publish' } -apply from: "${rootDir}/gradle/publish.gradle" - dependencies { api platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}") diff --git a/rego-java/build.gradle b/rego-java/build.gradle index 1909643..52475c7 100644 --- a/rego-java/build.gradle +++ b/rego-java/build.gradle @@ -1,9 +1,8 @@ plugins { id 'java-library' + id 'maven-publish' } -apply from: "${rootDir}/gradle/publish.gradle" - dependencies { api platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}")