diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e58261fcd..d07ce0e2a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,7 +65,6 @@ jobs: find `pwd`/examples -type f -name pom.xml -exec sed -i -e "s|\(\).*\(<\)|\1$LIB_VER\2|g" {} \; for d in $(ls -d `pwd`/examples/*/); do \ if [ -e $d/pom.xml ]; then cd $d && mvn --batch-mode --no-transfer-progress clean compile; fi; - if [ -e $d/gradlew ]; then cd $d && ./gradlew clean build; fi; done - name: Save clickhouse-jdbc-all for tests uses: actions/upload-artifact@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f9aabad..a530f4430 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,13 @@ backtick-quoted `INSERT` column-name component before the by-name server-schema lookup, matching how the table and database identifiers are already handled. (https://github.com/ClickHouse/clickhouse-java/issues/2896) +### Docs & Examples + +- **[examples]** Converted the remaining Gradle-based example projects (`client-v2-apache-arrow`, `demo-service`, + `demo-kotlin-service`) to Maven so that every project under `examples/` builds with a single, consistent toolchain. + The Gradle wrapper and build scripts were removed and each project now has a standalone `pom.xml`. + (https://github.com/ClickHouse/clickhouse-java/issues/2915) + ## 0.10.0-rc1, [Release Migration Guide](docs/releases/0_10_0.md) diff --git a/build_examples.sh b/build_examples.sh index 15c530eed..c20712986 100755 --- a/build_examples.sh +++ b/build_examples.sh @@ -3,6 +3,5 @@ LIB_VER=$(grep '' pom.xml | sed -e 's|[[:space:]]*<[/]*revision>[[:spa find `pwd`/examples -type f -name pom.xml -exec sed -i -e "s|\(\).*\(<\)|\1$LIB_VER\2|g" {} \; for d in $(ls -d `pwd`/examples/*/); do \ if [ -e $d/pom.xml ]; then cd $d && mvn --batch-mode --no-transfer-progress clean compile; fi; - if [ -e $d/gradlew ]; then cd $d && ./gradlew clean build; fi; done diff --git a/docs/client-v2-json-support.md b/docs/client-v2-json-support.md index ac34027c3..0cc400137 100644 --- a/docs/client-v2-json-support.md +++ b/docs/client-v2-json-support.md @@ -616,7 +616,7 @@ For these types, callers should obtain the parsed value through ## Examples -Two runnable Gradle examples are provided under `examples/`: +Two runnable Maven examples are provided under `examples/`: - `examples/client-v2-json-processors` exercises the `client-v2` API directly, switching between Jackson and Gson factories against a shared sample diff --git a/examples/client-v2-apache-arrow/.gitattributes b/examples/client-v2-apache-arrow/.gitattributes deleted file mode 100644 index f91f64602..000000000 --- a/examples/client-v2-apache-arrow/.gitattributes +++ /dev/null @@ -1,12 +0,0 @@ -# -# https://help.github.com/articles/dealing-with-line-endings/ -# -# Linux start script should use lf -/gradlew text eol=lf - -# These are Windows script files and should use crlf -*.bat text eol=crlf - -# Binary files should be left untouched -*.jar binary - diff --git a/examples/client-v2-apache-arrow/.gitignore b/examples/client-v2-apache-arrow/.gitignore index 1b6985c00..b55eb8af5 100644 --- a/examples/client-v2-apache-arrow/.gitignore +++ b/examples/client-v2-apache-arrow/.gitignore @@ -1,5 +1,2 @@ -# Ignore Gradle project-specific cache directory -.gradle - -# Ignore Gradle build output directory -build +# Maven build output +target/ diff --git a/examples/client-v2-apache-arrow/.mvn/jvm.config b/examples/client-v2-apache-arrow/.mvn/jvm.config new file mode 100644 index 000000000..5b0284770 --- /dev/null +++ b/examples/client-v2-apache-arrow/.mvn/jvm.config @@ -0,0 +1,3 @@ +--add-opens=java.base/java.nio=ALL-UNNAMED +--add-opens=java.base/sun.nio.ch=ALL-UNNAMED +--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED diff --git a/examples/client-v2-apache-arrow/README.md b/examples/client-v2-apache-arrow/README.md index 25b6bcf61..cb56722a3 100644 --- a/examples/client-v2-apache-arrow/README.md +++ b/examples/client-v2-apache-arrow/README.md @@ -14,17 +14,18 @@ The example shows: into another table by streaming the same `VectorSchemaRoot` straight back to `client.insert(...)`. -Unlike the other examples in this repository, this one is built with **Gradle** -(JDK 17 toolchain) and is not part of the Maven multi-module build. +Like the other examples in this repository, this one is built with **Maven** +(targeting JDK 17). It is a standalone project and is not part of the Maven +multi-module build. ## Requirements -- JDK 17 or newer (the Gradle toolchain will fetch one if it is missing). +- JDK 17 or newer. - A running ClickHouse server reachable from the machine running the example. Apache Arrow needs access to direct memory and a few internal JDK APIs. The -required `--add-opens` flags are already wired into `applicationDefaultJvmArgs` -in `build.gradle.kts`, so running the example through Gradle just works: +required `--add-opens` flags are wired into `.mvn/jvm.config`, so running the +example through `mvn ... exec:java` (which runs in the Maven JVM) just works: ```text --add-opens=java.base/java.nio=ALL-UNNAMED @@ -39,7 +40,7 @@ If you run the produced jar manually, pass these flags to the JVM yourself. From this directory: ```shell -./gradlew run +mvn compile exec:java ``` Connection properties can be supplied as system properties: @@ -52,7 +53,7 @@ Connection properties can be supplied as system properties: Example with custom connection properties: ```shell -./gradlew run \ +mvn compile exec:java \ -DchEndpoint=http://localhost:8123 \ -DchUser=default \ -DchPassword= \ @@ -62,7 +63,7 @@ Example with custom connection properties: To see the wire-level data flow, raise the SLF4J log level: ```shell -./gradlew run -Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG +mvn compile exec:java -Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG ``` ## Executable Example diff --git a/examples/client-v2-apache-arrow/build.gradle.kts b/examples/client-v2-apache-arrow/build.gradle.kts deleted file mode 100644 index 6d7f88dbe..000000000 --- a/examples/client-v2-apache-arrow/build.gradle.kts +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * This generated file contains a sample Java application project to get you started. - * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/9.2.1/userguide/building_java_projects.html in the Gradle documentation. - */ - -plugins { - // Apply the application plugin to add support for building a CLI application in Java. - application -} - -repositories { - // Use Maven Central for resolving dependencies. - mavenCentral() - mavenLocal() -} - -dependencies { - // Use TestNG framework, also requires calling test.useTestNG() below - testImplementation(libs.testng) - - implementation(libs.clickhouseClient) - - // BOM used to keep versions consistent across all Arrow libraries - implementation(platform(libs.arrowBom)) - implementation(libs.arrowVector) - implementation(libs.arrowMemory) - implementation(libs.arrowCompression) - - // Logging - implementation(libs.slf4jSimple) - implementation(libs.slf4jApi) - -} - -// Apply a specific Java toolchain to ease working on different environments. -java { - toolchain { - languageVersion = JavaLanguageVersion.of(17) - } -} - -application { - // Define the main class for the application. - mainClass = "com.clickhouse.examples.arrow_format.ReadWriteArrow" - applicationDefaultJvmArgs = listOf( - "-Dorg.slf4j.simpleLogger.defaultLogLevel=INFO", // change to DEBUG to see wire data flow - "--add-opens=java.base/java.nio=ALL-UNNAMED", // needed for Apache Arrow - "--add-opens=java.base/sun.nio.ch=ALL-UNNAMED", // needed for Apache Arrow - "--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED" // needed for Apache Arrow - ) -} - -tasks.named("test") { - // Use TestNG for unit tests. - useTestNG() -} diff --git a/examples/client-v2-apache-arrow/gradle.properties b/examples/client-v2-apache-arrow/gradle.properties deleted file mode 100644 index 377538c99..000000000 --- a/examples/client-v2-apache-arrow/gradle.properties +++ /dev/null @@ -1,5 +0,0 @@ -# This file was generated by the Gradle 'init' task. -# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties - -org.gradle.configuration-cache=true - diff --git a/examples/client-v2-apache-arrow/gradle/libs.versions.toml b/examples/client-v2-apache-arrow/gradle/libs.versions.toml deleted file mode 100644 index abcd8b054..000000000 --- a/examples/client-v2-apache-arrow/gradle/libs.versions.toml +++ /dev/null @@ -1,22 +0,0 @@ -# This file was generated by the Gradle 'init' task. -# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format - -[versions] -testng = "7.5.1" -arrowBom = "19.0.0" -slf4j = "2.0.17" -clickhouseClient = "0.9.8" - -[libraries] -testng = { module = "org.testng:testng", version.ref = "testng" } -clickhouseClient = { module = "com.clickhouse:client-v2", version.ref = "clickhouseClient" } - -# Arrow support -arrowBom = {module = "org.apache.arrow:arrow-bom", version.ref = "arrowBom"} -arrowVector = {module = "org.apache.arrow:arrow-vector" } -arrowMemory = {module = "org.apache.arrow:arrow-memory-netty" } -arrowCompression = { module = "org.apache.arrow:arrow-compression" } - -# Logging -slf4jSimple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j"} -slf4jApi = { module = "org.slf4j:slf4j-api", version.ref = "slf4j"} diff --git a/examples/client-v2-apache-arrow/gradle/wrapper/gradle-wrapper.jar b/examples/client-v2-apache-arrow/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index f8e1ee312..000000000 Binary files a/examples/client-v2-apache-arrow/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/examples/client-v2-apache-arrow/gradle/wrapper/gradle-wrapper.properties b/examples/client-v2-apache-arrow/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 23449a2b5..000000000 --- a/examples/client-v2-apache-arrow/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,7 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/examples/client-v2-apache-arrow/gradlew b/examples/client-v2-apache-arrow/gradlew deleted file mode 100755 index adff685a0..000000000 --- a/examples/client-v2-apache-arrow/gradlew +++ /dev/null @@ -1,248 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# 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/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -# 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 - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - 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 -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - - -# 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" \ - -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. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/examples/client-v2-apache-arrow/gradlew.bat b/examples/client-v2-apache-arrow/gradlew.bat deleted file mode 100644 index c4bdd3ab8..000000000 --- a/examples/client-v2-apache-arrow/gradlew.bat +++ /dev/null @@ -1,93 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@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 -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -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 - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -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 - - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* - -:end -@rem End local scope for the variables with windows NT shell -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! -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 - -:omega diff --git a/examples/client-v2-apache-arrow/pom.xml b/examples/client-v2-apache-arrow/pom.xml new file mode 100644 index 000000000..2de080399 --- /dev/null +++ b/examples/client-v2-apache-arrow/pom.xml @@ -0,0 +1,159 @@ + + + 4.0.0 + + com.clickhouse + client-v2-apache-arrow-examples + 1.0.0 + jar + + Client V2 Apache Arrow Examples + Client V2 Apache Arrow Examples + https://github.com/ClickHouse/clickhouse-java + 2026 + + + ClickHouse, Inc. + https://clickhouse.com/ + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0 + repo + + + + + https://github.com/ClickHouse/clickhouse-java + scm:git@github.com:ClickHouse/clickhouse-java.git + scm:git@github.com:ClickHouse/clickhouse-java.git + HEAD + + + + + + ossrh + Sonatype OSSRH + https://central.sonatype.com/repository/maven-snapshots/ + + false + + + true + + + + + + 2026 + UTF-8 + UTF-8 + + 0.10.0-rc1-SNAPSHOT + 19.0.0 + 2.0.17 + 7.5.1 + + 3.8.1 + 3.1.0 + + + 17 + all + + + + + + + org.apache.arrow + arrow-bom + ${arrow.version} + pom + import + + + + + + + com.clickhouse + client-v2 + ${clickhouse-java.version} + ${clickhouse-packages.classifier} + + + + + org.apache.arrow + arrow-vector + + + org.apache.arrow + arrow-memory-netty + + + org.apache.arrow + arrow-compression + + + + + org.slf4j + slf4j-api + ${slf4j.version} + + + org.slf4j + slf4j-simple + ${slf4j.version} + + + + org.testng + testng + ${testng.version} + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${compiler-plugin.version} + + ${minJdk} + ${minJdk} + true + + -Xlint:all + + + + + + + org.codehaus.mojo + exec-maven-plugin + ${exec-plugin.version} + + com.clickhouse.examples.arrow_format.ReadWriteArrow + + + + + diff --git a/examples/client-v2-apache-arrow/settings.gradle.kts b/examples/client-v2-apache-arrow/settings.gradle.kts deleted file mode 100644 index ab40df1d3..000000000 --- a/examples/client-v2-apache-arrow/settings.gradle.kts +++ /dev/null @@ -1,14 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/9.2.1/userguide/multi_project_builds.html in the Gradle documentation. - */ - -plugins { - // Apply the foojay-resolver plugin to allow automatic download of JDKs - id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" -} - -rootProject.name = "ch-java-apache-arrow" - diff --git a/examples/demo-kotlin-service/.gitignore b/examples/demo-kotlin-service/.gitignore index c426c32f8..228daac5e 100644 --- a/examples/demo-kotlin-service/.gitignore +++ b/examples/demo-kotlin-service/.gitignore @@ -1,8 +1,5 @@ -.gradle -build/ -!gradle/wrapper/gradle-wrapper.jar -!**/src/main/**/build/ -!**/src/test/**/build/ +# Maven build output +target/ ### STS ### .apt_generated @@ -30,7 +27,6 @@ out/ /nbbuild/ /dist/ /nbdist/ -/.nb-gradle/ ### VS Code ### -.vscode/ \ No newline at end of file +.vscode/ diff --git a/examples/demo-kotlin-service/build.gradle.kts b/examples/demo-kotlin-service/build.gradle.kts deleted file mode 100644 index 0a40ed855..000000000 --- a/examples/demo-kotlin-service/build.gradle.kts +++ /dev/null @@ -1,44 +0,0 @@ - -val kotlin_version: String by project -val logback_version: String by project -val ktor_version: String by project - -plugins { - kotlin("jvm") version "2.0.20" - id("io.ktor.plugin") version "2.3.12" -} - -group = "com.clickhouse" -version = "0.0.1" - -application { - mainClass.set("io.ktor.server.netty.EngineMain") - - val isDevelopment: Boolean = project.ext.has("development") - applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment") -} - -repositories { - mavenLocal() // comment to pull nightly builds instead of local cache - mavenCentral() - maven("https://central.sonatype.com/repository/maven-snapshots/") // for nightly builds -} - -val ch_java_client_version: String by extra - -dependencies { - // application dependencies - implementation("io.ktor:ktor-server-core-jvm") - implementation("io.ktor:ktor-server-netty-jvm") - implementation("ch.qos.logback:logback-classic:$logback_version") - implementation("io.ktor:ktor-server-config-yaml") - implementation("io.ktor:ktor-server-content-negotiation:$ktor_version") - implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor_version") - - // https://mvnrepository.com/artifact/com.clickhouse/client-v2 - implementation("com.clickhouse:client-v2:${ch_java_client_version}-SNAPSHOT:all") -// implementation("com.clickhouse:client-v2:${ch_java_client_version}:all") // release version - - testImplementation("io.ktor:ktor-server-test-host-jvm") - testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version") -} diff --git a/examples/demo-kotlin-service/gradle.properties b/examples/demo-kotlin-service/gradle.properties deleted file mode 100644 index 38bb7b1ca..000000000 --- a/examples/demo-kotlin-service/gradle.properties +++ /dev/null @@ -1,6 +0,0 @@ -kotlin.code.style=official -ktor_version=2.3.12 -kotlin_version=2.0.20 -logback_version=1.4.14 - -ch_java_client_version=0.10.0-rc1 \ No newline at end of file diff --git a/examples/demo-kotlin-service/gradle/wrapper/gradle-wrapper.jar b/examples/demo-kotlin-service/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7454180f2..000000000 Binary files a/examples/demo-kotlin-service/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/examples/demo-kotlin-service/gradle/wrapper/gradle-wrapper.properties b/examples/demo-kotlin-service/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e411586a5..000000000 --- a/examples/demo-kotlin-service/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/examples/demo-kotlin-service/gradlew b/examples/demo-kotlin-service/gradlew deleted file mode 100755 index 1b6c78733..000000000 --- a/examples/demo-kotlin-service/gradlew +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# 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 -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -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"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -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. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - 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. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/examples/demo-kotlin-service/gradlew.bat b/examples/demo-kotlin-service/gradlew.bat deleted file mode 100644 index 107acd32c..000000000 --- a/examples/demo-kotlin-service/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "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. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -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. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="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 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/examples/demo-kotlin-service/pom.xml b/examples/demo-kotlin-service/pom.xml new file mode 100644 index 000000000..2556b5927 --- /dev/null +++ b/examples/demo-kotlin-service/pom.xml @@ -0,0 +1,213 @@ + + + 4.0.0 + + com.clickhouse + demo-kotlin-service + 0.0.1 + jar + + ClickHouse Java Kotlin Demo Service + Ktor service using the ClickHouse client-v2 + https://github.com/ClickHouse/clickhouse-java + 2026 + + + ClickHouse, Inc. + https://clickhouse.com/ + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0 + repo + + + + + https://github.com/ClickHouse/clickhouse-java + scm:git@github.com:ClickHouse/clickhouse-java.git + scm:git@github.com:ClickHouse/clickhouse-java.git + HEAD + + + + + + ossrh + Sonatype OSSRH + https://central.sonatype.com/repository/maven-snapshots/ + + false + + + true + + + + + + 2026 + UTF-8 + UTF-8 + 17 + + 0.10.0-rc1-SNAPSHOT + all + + 2.0.20 + 17 + 2.3.12 + 1.4.14 + + io.ktor.server.netty.EngineMain + + 3.5.1 + + + + + + io.ktor + ktor-bom + ${ktor.version} + pom + import + + + + + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + + + + + io.ktor + ktor-server-core-jvm + + + io.ktor + ktor-server-netty-jvm + + + io.ktor + ktor-server-config-yaml-jvm + + + io.ktor + ktor-server-content-negotiation-jvm + + + io.ktor + ktor-serialization-kotlinx-json-jvm + + + + ch.qos.logback + logback-classic + ${logback.version} + + + + com.clickhouse + client-v2 + ${clickhouse-java.version} + ${clickhouse-packages.classifier} + + + + + io.ktor + ktor-server-test-host-jvm + test + + + org.jetbrains.kotlin + kotlin-test-junit + ${kotlin.version} + test + + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/test/kotlin + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + ${kotlin.compiler.jvmTarget} + + + + compile + compile + + compile + + + + ${project.basedir}/src/main/kotlin + + + + + test-compile + test-compile + + test-compile + + + + ${project.basedir}/src/test/kotlin + + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + ${shade-plugin.version} + + + package + + shade + + + + + ${main.class} + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + module-info.class + + + + + + + + + + diff --git a/examples/demo-kotlin-service/settings.gradle.kts b/examples/demo-kotlin-service/settings.gradle.kts deleted file mode 100644 index be84eb828..000000000 --- a/examples/demo-kotlin-service/settings.gradle.kts +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = "com.clickhouse.examples" diff --git a/examples/demo-service/.gitignore b/examples/demo-service/.gitignore index c2065bc26..228daac5e 100644 --- a/examples/demo-service/.gitignore +++ b/examples/demo-service/.gitignore @@ -1,9 +1,5 @@ -HELP.md -.gradle -build/ -!gradle/wrapper/gradle-wrapper.jar -!**/src/main/**/build/ -!**/src/test/**/build/ +# Maven build output +target/ ### STS ### .apt_generated @@ -31,7 +27,6 @@ out/ /nbbuild/ /dist/ /nbdist/ -/.nb-gradle/ ### VS Code ### .vscode/ diff --git a/examples/demo-service/README.md b/examples/demo-service/README.md index c8a1608e2..8c76c3191 100644 --- a/examples/demo-service/README.md +++ b/examples/demo-service/README.md @@ -42,7 +42,7 @@ ORDER BY timestamp ### Run Demo-Service ```shell -./gradlew bootRun +mvn spring-boot:run ``` ### Interact with API diff --git a/examples/demo-service/build.gradle.kts b/examples/demo-service/build.gradle.kts deleted file mode 100644 index e320d7cdb..000000000 --- a/examples/demo-service/build.gradle.kts +++ /dev/null @@ -1,59 +0,0 @@ -plugins { - java - id("org.springframework.boot") version "3.4.4" - id("io.spring.dependency-management") version "1.1.7" -} - -group = "com.clickhouse" -version = "0.0.1-SNAPSHOT" - -java { - toolchain { - languageVersion = JavaLanguageVersion.of(17) - } -} - -configurations { - compileOnly { - extendsFrom(configurations.annotationProcessor.get()) - } -} - -repositories { - mavenLocal() // comment to pull nightly builds instead of local cache - mavenCentral() - maven("https://central.sonatype.com/repository/maven-snapshots/") -} - -val ch_java_client_version: String by extra - -dependencies { - - // Add this if working with client directly (not JDBC) -// implementation("com.clickhouse:client-v2:${ch_java_client_version}-SNAPSHOT:all") // local or nightly build -// implementation("com.clickhouse:client-v2:${ch_java_client_version}:all") // release version - - // OR this if working with JDBC (or both) - implementation("com.clickhouse:clickhouse-jdbc:${ch_java_client_version}-SNAPSHOT:all") // local or nightly build -// implementation("com.clickhouse:clickhouse-jdbc:${ch_java_client_version}:all") // release version - - // Other dependencies - implementation("org.springframework.boot:spring-boot-starter-actuator") - implementation("org.springframework.boot:spring-boot-starter-web") - - // To enable JPA - implementation("org.springframework.boot:spring-boot-starter-data-jpa") - - compileOnly("org.projectlombok:lombok") - annotationProcessor("org.projectlombok:lombok") - - implementation("io.micrometer:micrometer-core:1.14.3") - - // -- test dependencies - testImplementation("org.springframework.boot:spring-boot-starter-test") - testRuntimeOnly("org.junit.platform:junit-platform-launcher") -} - -tasks.withType { - useJUnitPlatform() -} diff --git a/examples/demo-service/gradle.properties b/examples/demo-service/gradle.properties deleted file mode 100644 index 91d6540f6..000000000 --- a/examples/demo-service/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ - -ch_java_client_version=0.10.0-rc1 \ No newline at end of file diff --git a/examples/demo-service/gradle/wrapper/gradle-wrapper.jar b/examples/demo-service/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e6441136f..000000000 Binary files a/examples/demo-service/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/examples/demo-service/gradle/wrapper/gradle-wrapper.properties b/examples/demo-service/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index a4413138c..000000000 --- a/examples/demo-service/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,7 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/examples/demo-service/gradlew b/examples/demo-service/gradlew deleted file mode 100755 index b740cf133..000000000 --- a/examples/demo-service/gradlew +++ /dev/null @@ -1,249 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# 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/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - 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 -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - - -# 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, 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 \ - "$@" - -# 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. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/examples/demo-service/gradlew.bat b/examples/demo-service/gradlew.bat deleted file mode 100644 index 7101f8e46..000000000 --- a/examples/demo-service/gradlew.bat +++ /dev/null @@ -1,92 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -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 - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -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 - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -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! -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 - -:omega diff --git a/examples/demo-service/pom.xml b/examples/demo-service/pom.xml new file mode 100644 index 000000000..280077896 --- /dev/null +++ b/examples/demo-service/pom.xml @@ -0,0 +1,132 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 3.4.4 + + + + com.clickhouse + demo-service + 0.0.1-SNAPSHOT + jar + + ClickHouse Java Demo Service + Spring Boot service using the ClickHouse client directly and via JPA + https://github.com/ClickHouse/clickhouse-java + 2026 + + + ClickHouse, Inc. + https://clickhouse.com/ + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0 + repo + + + + + https://github.com/ClickHouse/clickhouse-java + scm:git@github.com:ClickHouse/clickhouse-java.git + scm:git@github.com:ClickHouse/clickhouse-java.git + HEAD + + + + + + ossrh + Sonatype OSSRH + https://central.sonatype.com/repository/maven-snapshots/ + + false + + + true + + + + + + 2026 + 17 + + 0.10.0-rc1-SNAPSHOT + all + 1.14.3 + + + + + com.clickhouse + clickhouse-jdbc + ${clickhouse-java.version} + ${clickhouse-packages.classifier} + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + org.projectlombok + lombok + provided + + + + io.micrometer + micrometer-core + ${micrometer.version} + + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.platform + junit-platform-launcher + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + diff --git a/examples/demo-service/settings.gradle.kts b/examples/demo-service/settings.gradle.kts deleted file mode 100644 index fd03efa9c..000000000 --- a/examples/demo-service/settings.gradle.kts +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = "demo-service" diff --git a/release.sh b/release.sh index 653180145..4508b09a5 100755 --- a/release.sh +++ b/release.sh @@ -16,6 +16,5 @@ sed -i "s|.*<\/clickhouse-java.version>|.*<\/clickhouse-java.version>|${RELEASE_VERSION}-SNAPSHOT<\/clickhouse-java.version>|g" '{}' \; -find ./examples/ -type f -name "gradle.properties" -exec sed -i "s|^ch_java_client_version=.*$|ch_java_client_version=${RELEASE_VERSION}|g" '{}' \; find ./performance/ -type f -name "pom.xml" -exec sed -i "s|.*<\/ch.jdbc.revision>|${RELEASE_VERSION}-SNAPSHOT<\/ch.jdbc.revision>|g" '{}' \;