Skip to content

Commit

Permalink
Ensure Java 21 compatibility (#166)
Browse files Browse the repository at this point in the history
* Ensure Java 21 compatibility

* Fix param

* Fix readme

* fix condition on java17

* Remove deprecated api
  • Loading branch information
loicgreffier authored Feb 14, 2024
1 parent 8fe84ee commit 8615627
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 17 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17', '21' ]
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK 17
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: maven

Expand All @@ -36,6 +39,7 @@ jobs:
report_paths: '**/target/surefire-reports/TEST-*.xml'

- name: Sonar
if: matrix.java == '17'
run: mvn verify sonar:sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/on_push_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17', '21' ]
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK 17
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: maven
server-id: ossrh
Expand Down Expand Up @@ -44,13 +47,14 @@ jobs:
report_paths: '**/target/surefire-reports/TEST-*.xml'

- name: Sonar
if: matrix.java == '17'
run: mvn verify sonar:sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Deploy
if: endsWith(steps.build.outputs.current_version, '-SNAPSHOT')
if: endsWith(steps.build.outputs.current_version, '-SNAPSHOT') && matrix.java == '17'
run: mvn -B deploy -DskipTests -Psign
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ need to do:

## Dependencies

Kstreamplify offers three dependencies, all compatible with Java 17.
Kstreamplify offers three dependencies, all compatible with Java 17 and 21.

### Java

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class JsonToAvroConverter {
* @return the record in avro
*/
public static SpecificRecordBase jsonToAvro(String file, Schema schema) {
return jsonToAvro((JsonObject) new JsonParser().parse(file), schema);
return jsonToAvro(JsonParser.parseString(file).getAsJsonObject(), schema);
}

/**
Expand Down
34 changes: 24 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,22 @@

<properties>
<avro.version>1.11.3</avro.version>
<checkstyle.version>10.12.7</checkstyle.version>
<commons-io.version>2.15.1</commons-io.version>
<commons-lang3.version>3.14.0</commons-lang3.version>
<gson.version>2.10.1</gson.version>
<java.version>17</java.version>
<junit-jupiter.version>5.10.2</junit-jupiter.version>
<kafka.version>3.4.0</kafka.version>
<kafka.version>3.6.1</kafka.version>
<kafka-streams-avro-serde.version>7.6.0</kafka-streams-avro-serde.version>
<lombok.version>1.18.30</lombok.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<mockito.version>5.10.0</mockito.version>
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<maven.compiler.java.version>17</maven.compiler.java.version>
<maven-compiler-plugin.version>3.12.1</maven-compiler-plugin.version>
<maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
<jacoco.version>0.8.11</jacoco.version>
<spring-boot.version>3.2.2</spring-boot.version>
<testcontainers.version>1.19.5</testcontainers.version>
Expand Down Expand Up @@ -221,10 +226,19 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<release>${maven.compiler.java.version}</release>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -239,7 +253,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<version>${maven-javadoc-plugin.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -254,7 +268,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<version>${maven-surefire-plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down Expand Up @@ -301,12 +315,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
<version>${maven-checkstyle-plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.13.0</version>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
<configuration>
Expand Down Expand Up @@ -363,7 +377,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand Down

0 comments on commit 8615627

Please sign in to comment.