This is an automated email from the ASF dual-hosted git repository. maciej pushed a commit to branch java-configuration in repository https://gitbox.apache.org/repos/asf/iggy.git
commit 314b9f5e6f28729248bf129766e42b307d8a4ff5 Author: Maciej Modzelewski <[email protected]> AuthorDate: Fri Nov 21 10:03:35 2025 +0100 chore(java): change version for release, update dependencies, refactor configuration --- foreign/java/README.md | 45 +++++++----- foreign/java/build.gradle.kts | 55 +++++++++++++++ foreign/java/examples/build.gradle.kts | 9 +-- .../iggy-connector-library/build.gradle.kts | 37 ++-------- .../iggy-flink-examples/build.gradle.kts | 7 +- foreign/java/gradle.properties | 2 + foreign/java/gradle/wrapper/gradle-wrapper.jar | Bin 60756 -> 43764 bytes .../java/gradle/wrapper/gradle-wrapper.properties | 5 +- foreign/java/gradlew | 47 +++++++++---- foreign/java/gradlew.bat | 41 ++++++----- foreign/java/java-sdk/build.gradle.kts | 76 +++++---------------- 11 files changed, 170 insertions(+), 154 deletions(-) diff --git a/foreign/java/README.md b/foreign/java/README.md index 533883634..c22779ce0 100644 --- a/foreign/java/README.md +++ b/foreign/java/README.md @@ -1,27 +1,40 @@ -# Java SDK for Iggy +# Java SDK for Apache Iggy -[Iggy GitHub](https://github.com/apache/iggy) | [Website](https://iggy.apache.org) | [Getting started](https://iggy.apache.org/docs/introduction/getting-started) | [Documentation](https://iggy.apache.org/docs) | [Blog](https://iggy.apache.org/blogs) | [Discord](https://discord.gg/C5Sux5NcRa) +Official Java client SDK for [Apache Iggy](https://iggy.apache.org) message streaming. -[](https://github.com/apache/iggy/actions/workflows/ci-check-java-sdk.yml) -[](https://x.com/ApacheIggy) +> This is part of the Apache Iggy monorepo. For the main project, see the [root repository](https://github.com/apache/iggy). ---- +## Installation -Official Java client SDK for [Apache Iggy](https://iggy.apache.org) message streaming. +Add the dependency to your project: + +**Gradle:** +```gradle +implementation 'org.apache.iggy:iggy:0.6.0' +``` + +**Maven:** +```xml +<dependency> + <groupId>org.apache.iggy</groupId> + <artifactId>iggy</artifactId> + <version>0.6.0</version> +</dependency> +``` + +Find the latest version on [Maven Central](https://central.sonatype.com/artifact/org.apache.iggy/iggy). -The client currently supports HTTP and TCP protocols with blocking implementation. +## Examples -## Adding the client to your project +See the [`examples`](examples/) module for basic consumer and producer implementations using the SDK. -Add dependency to `pom.xml` or `build.gradle` file. +For Apache Flink integration, see the [Flink Connector Library](external-processors/iggy-connector-flink/iggy-connector-library/README.md). -You can find the latest version in Maven Central repository: +## Contributing -<https://central.sonatype.com/artifact/org.apache.iggy/iggy-java-sdk> +Before opening a pull request: -## Implement consumer and producer +1. **Format code:** `./gradlew spotlessApply` +2. **Validate build:** `./gradlew check` -You can find examples for -simple [consumer](https://github.com/apache/iggy/blob/master/foreign/java/examples/simple-consumer/src/main/java/org/apache/iggy/SimpleConsumer.java) -and [producer](https://github.com/apache/iggy/blob/master/foreign/java/examples/simple-producer/src/main/java/org/apache/iggy/SimpleProducer.java) -in the repository. +This ensures code style compliance and that all tests and checkstyle validations pass. diff --git a/foreign/java/build.gradle.kts b/foreign/java/build.gradle.kts index 922fdd16e..415fa3f0b 100644 --- a/foreign/java/build.gradle.kts +++ b/foreign/java/build.gradle.kts @@ -47,4 +47,59 @@ subprojects { configDirectory = file("${project.rootDir}/dev-support/checkstyle") } } + + // Configure publishing for modules that publish to Maven + plugins.withId("maven-publish") { + apply(plugin = "signing") + + configure<PublishingExtension> { + publications { + create<MavenPublication>("maven") { + from(components["java"]) + + pom { + url = "https://github.com/apache/iggy" + licenses { + license { + name = "Apache License, Version 2.0" + url = "https://www.apache.org/licenses/LICENSE-2.0.txt" + } + } + developers { + developer { + name = "Apache Iggy" + email = "[email protected]" + } + } + scm { + url = "https://github.com/apache/iggy" + connection = "scm:git:git://github.com/apache/iggy.git" + developerConnection = "scm:git:git://github.com/apache/iggy.git" + } + } + } + } + + repositories { + maven { + val releasesRepoUrl = "https://repository.apache.org/service/local/staging/deploy/maven2" + val snapshotsRepoUrl = "https://repository.apache.org/content/repositories/snapshots/" + + url = uri(if ((version as String).endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl) + + credentials { + username = System.getenv("NEXUS_USER") + password = System.getenv("NEXUS_PW") + } + } + } + } + + configure<SigningExtension> { + val signingKey: String? by project + val signingPassword: String? by project + useInMemoryPgpKeys(signingKey, signingPassword) + sign(the<PublishingExtension>().publications) + } + } } diff --git a/foreign/java/examples/build.gradle.kts b/foreign/java/examples/build.gradle.kts index 6f7e8eac4..ed5cba4f9 100644 --- a/foreign/java/examples/build.gradle.kts +++ b/foreign/java/examples/build.gradle.kts @@ -22,9 +22,6 @@ plugins { id("application") } -group = "org.apache.iggy" -version = "0.6.0-SNAPSHOT" - repositories { mavenCentral() } @@ -35,9 +32,9 @@ application { dependencies { implementation(project(":iggy")) - implementation("org.slf4j:slf4j-api:2.0.9") - runtimeOnly("ch.qos.logback:logback-classic:1.4.12") - runtimeOnly("io.netty:netty-resolver-dns-native-macos:4.2.1.Final:osx-aarch_64") + implementation("org.slf4j:slf4j-api:2.0.17") + runtimeOnly("ch.qos.logback:logback-classic:1.5.21") + runtimeOnly("io.netty:netty-resolver-dns-native-macos:4.2.7.Final:osx-aarch_64") } // Task for running async consumer example diff --git a/foreign/java/external-processors/iggy-connector-flink/iggy-connector-library/build.gradle.kts b/foreign/java/external-processors/iggy-connector-flink/iggy-connector-library/build.gradle.kts index 287f764f1..a9e2bcfd2 100644 --- a/foreign/java/external-processors/iggy-connector-flink/iggy-connector-library/build.gradle.kts +++ b/foreign/java/external-processors/iggy-connector-flink/iggy-connector-library/build.gradle.kts @@ -22,9 +22,6 @@ plugins { id("maven-publish") } -group = "org.apache.iggy" -version = "0.6.0-SNAPSHOT" - repositories { mavenCentral() } @@ -39,7 +36,6 @@ java { } val flinkVersion = "2.1.0" -val iggyVersion = "0.6.0-SNAPSHOT" dependencies { // Iggy SDK - use local project when building within Iggy repository @@ -59,8 +55,8 @@ dependencies { // Testing testImplementation("org.apache.flink:flink-test-utils:${flinkVersion}") testImplementation("org.apache.flink:flink-runtime:${flinkVersion}:tests") - testImplementation("org.junit.jupiter:junit-jupiter:5.11.3") - testImplementation("org.assertj:assertj-core:3.26.3") + testImplementation("org.junit.jupiter:junit-jupiter:5.14.1") + testImplementation("org.assertj:assertj-core:3.27.6") testRuntimeOnly("org.slf4j:slf4j-simple:2.0.16") } @@ -79,33 +75,12 @@ tasks.withType<Javadoc> { publishing { publications { - create<MavenPublication>("maven") { - groupId = "org.apache.iggy" - artifactId = "iggy-connector-library" - version = "0.6.0-SNAPSHOT" - from(components["java"]) + named<MavenPublication>("maven") { + artifactId = "flink-connector" pom { - name = "Apache Iggy Connector Library" - description = "Core connector library for Apache Iggy stream processors (Flink, Spark, etc.)" - url = "https://github.com/apache/iggy" - licenses { - license { - name = "Apache License, Version 2.0" - url = "https://www.apache.org/licenses/LICENSE-2.0.txt" - } - } - developers { - developer { - name = "Apache Iggy" - email = "[email protected]" - } - } - scm { - url = "https://github.com/apache/iggy" - connection = "scm:git:git://github.com/apache/iggy.git" - developerConnection = "scm:git:git://github.com/apache/iggy.git" - } + name = "Apache Iggy - Flink Connector" + description = "Apache Iggy connector library supporting Apache Flink" } } } diff --git a/foreign/java/external-processors/iggy-connector-flink/iggy-flink-examples/build.gradle.kts b/foreign/java/external-processors/iggy-connector-flink/iggy-flink-examples/build.gradle.kts index 68b797741..f983e6a81 100644 --- a/foreign/java/external-processors/iggy-connector-flink/iggy-flink-examples/build.gradle.kts +++ b/foreign/java/external-processors/iggy-connector-flink/iggy-flink-examples/build.gradle.kts @@ -17,16 +17,11 @@ * under the License. */ -import org.gradle.external.javadoc.StandardJavadocDocletOptions - plugins { application id("com.github.johnrengelman.shadow") version "8.1.1" } -group = "org.apache.iggy" -version = "0.6.0-SNAPSHOT" - repositories { mavenCentral() } @@ -58,7 +53,7 @@ dependencies { implementation("com.typesafe:config:1.4.3") // Testing - testImplementation("org.junit.jupiter:junit-jupiter:5.11.3") + testImplementation("org.junit.jupiter:junit-jupiter:5.14.1") testImplementation("org.assertj:assertj-core:3.26.3") testRuntimeOnly("org.slf4j:slf4j-simple:2.0.16") } diff --git a/foreign/java/gradle.properties b/foreign/java/gradle.properties new file mode 100644 index 000000000..ea001d5bf --- /dev/null +++ b/foreign/java/gradle.properties @@ -0,0 +1,2 @@ +version=0.6.0 +group=org.apache.iggy diff --git a/foreign/java/gradle/wrapper/gradle-wrapper.jar b/foreign/java/gradle/wrapper/gradle-wrapper.jar index 249e5832f..1b33c55ba 100644 Binary files a/foreign/java/gradle/wrapper/gradle-wrapper.jar and b/foreign/java/gradle/wrapper/gradle-wrapper.jar differ diff --git a/foreign/java/gradle/wrapper/gradle-wrapper.properties b/foreign/java/gradle/wrapper/gradle-wrapper.properties index 004e84f53..d4081da47 100644 --- a/foreign/java/gradle/wrapper/gradle-wrapper.properties +++ b/foreign/java/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Mon Sep 18 13:34:16 CEST 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/foreign/java/gradlew b/foreign/java/gradlew index 1b6c78733..23d15a936 100755 --- a/foreign/java/gradlew +++ b/foreign/java/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +82,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -114,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -133,22 +133,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,18 +200,28 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/foreign/java/gradlew.bat b/foreign/java/gradlew.bat index 107acd32c..db3a6ac20 100644 --- a/foreign/java/gradlew.bat +++ b/foreign/java/gradlew.bat @@ -13,8 +13,10 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -56,32 +59,34 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/foreign/java/java-sdk/build.gradle.kts b/foreign/java/java-sdk/build.gradle.kts index 3065b4558..a03cbde84 100644 --- a/foreign/java/java-sdk/build.gradle.kts +++ b/foreign/java/java-sdk/build.gradle.kts @@ -20,12 +20,8 @@ plugins { id("java-library") id("maven-publish") - id("signing") } -group = "org.apache.iggy" -version = "0.6.0-SNAPSHOT" - repositories { mavenCentral() } @@ -39,29 +35,23 @@ java { withSourcesJar() } -signing { - val signingKey: String? by project - val signingPassword: String? by project - useInMemoryPgpKeys(signingKey, signingPassword) - sign(publishing.publications) -} - dependencies { - implementation("org.apache.httpcomponents.client5:httpclient5:5.4.3") - implementation("com.fasterxml.jackson.core:jackson-databind:2.18.0") - implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.0") - implementation("org.apache.commons:commons-lang3:3.18.0") - implementation("org.slf4j:slf4j-api:2.0.16") - implementation("com.google.code.findbugs:jsr305:3.0.2") - implementation("io.projectreactor:reactor-core:3.6.11") - implementation("io.projectreactor.netty:reactor-netty-core:1.1.23") - testImplementation("org.testcontainers:testcontainers:1.20.3") - testImplementation("org.testcontainers:junit-jupiter:1.20.3") - testImplementation(platform("org.junit:junit-bom:5.11.3")) + implementation("org.apache.httpcomponents.client5:httpclient5:5.5.1") + implementation("com.fasterxml.jackson.core:jackson-databind:2.20.1") + implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.20.1") + implementation("org.apache.commons:commons-lang3:3.20.0") + implementation("org.slf4j:slf4j-api:2.0.17") + implementation("com.github.spotbugs:spotbugs-annotations:4.9.8") + implementation("io.projectreactor:reactor-core:3.8.0") + implementation("io.projectreactor.netty:reactor-netty-core:1.3.0") + testImplementation("org.testcontainers:testcontainers:1.21.3") + testImplementation("org.testcontainers:junit-jupiter:1.21.3") + testImplementation(platform("org.junit:junit-bom:5.14.1")) testImplementation("org.junit.jupiter:junit-jupiter") - testImplementation("org.assertj:assertj-core:3.26.3") - testRuntimeOnly("ch.qos.logback:logback-classic:1.5.11") - testRuntimeOnly("io.netty:netty-resolver-dns-native-macos:4.2.1.Final:osx-aarch_64") + testImplementation("org.assertj:assertj-core:3.27.6") + testRuntimeOnly("org.junit.platform:junit-platform-launcher") + testRuntimeOnly("ch.qos.logback:logback-classic:1.5.21") + testRuntimeOnly("io.netty:netty-resolver-dns-native-macos:4.2.7.Final:osx-aarch_64") } tasks.withType<Test> { @@ -70,47 +60,13 @@ tasks.withType<Test> { publishing { publications { - create<MavenPublication>("maven") { - from(components["java"]) - + named<MavenPublication>("maven") { pom { name = "Apache Iggy Java Client SDK" description = "Official Java client SDK for Apache Iggy.\n" + "Apache Iggy (Incubating) is an effort undergoing incubation at the Apache Software Foundation (ASF), " + "sponsored by the Apache Incubator PMC." - url = "https://github.com/apache/iggy" packaging = "jar" - licenses { - license { - name = "Apache License, Version 2.0" - url = "https://www.apache.org/licenses/LICENSE-2.0.txt" - } - } - developers { - developer { - name = "Apache Iggy" - email = "[email protected]" - } - scm { - url = "https://github.com/apache/iggy" - connection = "scm:git:git://github.com/apache/iggy.git" - developerConnection = "scm:git:git://github.com/apache/iggy.git" - } - } - } - } - } - - repositories { - maven { - val releasesRepoUrl = "https://repository.apache.org/service/local/staging/deploy/maven2" - val snapshotsRepoUrl = "https://repository.apache.org/content/repositories/snapshots/" - - url = uri(if ((version as String).endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl) - - credentials { - username = System.getenv("NEXUS_USER") - password = System.getenv("NEXUS_PW") } } }
