THRIFT-5581: use gradle 7 for java/kotlin (#2601)
* upgrade gradle version to 7.4
* migrate from `maven` plugin to `maven-publish` plugin as required for Gradle 7
* add guard to ktfmt, since it can't run with JDK 8
Co-authored-by: Christopher Tubbs <ctubbsii@apache.org>
diff --git a/lib/java/README.md b/lib/java/README.md
index 214ac90..d60dbb7 100644
--- a/lib/java/README.md
+++ b/lib/java/README.md
@@ -42,7 +42,7 @@
the Gradle build system, which tends to be predominant amongst Java
developers.
-Currently we use gradle 6.9.2 to build the Thrift Java source. The usual way to setup gradle
+Currently we use gradle 7.4.2 to build the Thrift Java source. The usual way to setup gradle
project is to include the gradle-wrapper.jar in the project and then run the gradle wrapper to
bootstrap setting up gradle binaries. However to avoid putting binary files into the source tree we
have ignored the gradle wrapper files. You are expected to install it manually, as described in
@@ -50,13 +50,13 @@
following this step (which is also done in the travis CI docker images):
```bash
-export GRADLE_VERSION="6.9.2"
+export GRADLE_VERSION="7.4.2"
# install dependencies
apt-get install -y --no-install-recommends openjdk-11-jdk-headless wget unzip
# download gradle distribution
wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip -q -O /tmp/gradle-$GRADLE_VERSION-bin.zip
# check binary integrity
-echo "8b356fd8702d5ffa2e066ed0be45a023a779bba4dd1a68fd11bc2a6bdc981e8f /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -
+echo "29e49b10984e585d8118b7d0bc452f944e386458df27371b49b4ac1dec4b7fda /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -
# unzip and install
unzip -d /tmp /tmp/gradle-$GRADLE_VERSION-bin.zip
mv /tmp/gradle-$GRADLE_VERSION /usr/local/gradle
@@ -103,7 +103,7 @@
where other Maven or Gradle builds can reference it simply do this.
```bash
-gradle install
+gradle publishToMavenLocal
```
The library will be placed in your home directory under .m2/repository
@@ -163,7 +163,7 @@
make MavenPublish -- This is for a CMake generated build
```
-The uploadArchives task in Gradle is preconfigured with all necessary details
+The `publish` task in Gradle is preconfigured with all necessary details
to sign and publish the artifacts from the build to the Apache Maven staging
repository. The task requires the following externally provided properties to
authenticate to the repository and sign the artifacts. The preferred approach
@@ -190,7 +190,7 @@
if needed the build artifacts and proceed to publish the results.
```bash
-gradle -Prelease=true uploadArchives
+gradle -Prelease=true publish
```
It is also possible to override the target repository for the Maven Publication
@@ -205,7 +205,7 @@
Or the same on the command line:
```bash
-gradle -Pmaven-repository-url=https://my.company.com/service/local/staging/deploy/maven2 -Prelease=true -Pthrift.version=0.11.0 uploadArchives
+gradle -Pmaven-repository-url=https://my.company.com/service/local/staging/deploy/maven2 -Prelease=true -Pthrift.version=0.11.0 publish
```