瀏覽代碼

Upgrade to Java 17 (Azul Zulu) (#2879)

* Feature: Upgrade to Java 17 (Azul Zulu)

Java/OpenJDK 13 has reached end of life (and end of security support)
more than 2.5 years ago: https://endoflife.date/java

This change set updates the build, CI pipeline, and Docker image of Kafka UI to Java 17 (LTS).

* Add back maven-compile-plugin to kafka-ui-e2e-checks
Jochen Schalanda 2 年之前
父節點
當前提交
62f35e3e29

+ 5 - 10
.github/workflows/backend.yml

@@ -16,17 +16,12 @@ jobs:
         with:
           fetch-depth: 0
           ref: ${{ github.event.pull_request.head.sha }}
-      - name: Cache local Maven repository
-        uses: actions/cache@v3
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
-      - name: Set up JDK 1.13
-        uses: actions/setup-java@v1
+      - name: Set up JDK
+        uses: actions/setup-java@v3
         with:
-          java-version: 1.13
+          java-version: '17'
+          distribution: 'zulu'
+          cache: 'maven'
       - name: Cache SonarCloud packages
         uses: actions/cache@v3
         with:

+ 5 - 10
.github/workflows/branch-deploy.yml

@@ -17,17 +17,12 @@ jobs:
           echo ::set-output name=tag::${tag}
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-      - name: Cache local Maven repository
-        uses: actions/cache@v3
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
-      - name: Set up JDK 1.13
-        uses: actions/setup-java@v1
+      - name: Set up JDK
+        uses: actions/setup-java@v3
         with:
-          java-version: 1.13
+          java-version: '17'
+          distribution: 'zulu'
+          cache: 'maven'
       - name: Build
         id: build
         run: |

+ 5 - 10
.github/workflows/build-public-image.yml

@@ -14,17 +14,12 @@ jobs:
         run: |
           tag='${{ github.event.pull_request.number }}'
           echo ::set-output name=tag::${tag}
-      - name: Cache local Maven repository
-        uses: actions/cache@v3
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
-      - name: Set up JDK 1.13
-        uses: actions/setup-java@v1
+      - name: Set up JDK
+        uses: actions/setup-java@v3
         with:
-          java-version: 1.13
+          java-version: '17'
+          distribution: 'zulu'
+          cache: 'maven'
       - name: Build
         id: build
         run: |

+ 5 - 11
.github/workflows/cve.yaml

@@ -10,18 +10,12 @@ jobs:
     steps:
       - uses: actions/checkout@v3
 
-      - name: Cache local Maven repository
-        uses: actions/cache@v3
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
-
-      - name: Set up JDK 1.13
-        uses: actions/setup-java@v1
+      - name: Set up JDK
+        uses: actions/setup-java@v3
         with:
-          java-version: 1.13
+          java-version: '17'
+          distribution: 'zulu'
+          cache: 'maven'
 
       - name: Build project
         id: build

+ 5 - 10
.github/workflows/e2e-checks.yaml

@@ -15,13 +15,6 @@ jobs:
       - uses: actions/checkout@v3
         with:
           ref: ${{ github.event.pull_request.head.sha }}
-      - name: Cache local Maven repository
-        uses: actions/cache@v3
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
       - name: Set the values
         id: set_env_values
         run: |
@@ -30,10 +23,12 @@ jobs:
         id: pull_chrome
         run: |
           docker pull selenium/standalone-chrome:103.0
-      - name: Set up JDK 1.13
-        uses: actions/setup-java@v1
+      - name: Set up JDK
+        uses: actions/setup-java@v3
         with:
-          java-version: 1.13
+          java-version: '17'
+          distribution: 'zulu'
+          cache: 'maven'
       - name: Build with Maven
         id: build_app
         run: |

+ 5 - 11
.github/workflows/master.yaml

@@ -10,18 +10,12 @@ jobs:
     steps:
       - uses: actions/checkout@v3
 
-      - name: Cache local Maven repository
-        uses: actions/cache@v3
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
-
-      - name: Set up JDK 1.13
-        uses: actions/setup-java@v1
+      - name: Set up JDK
+        uses: actions/setup-java@v3
         with:
-          java-version: 1.13
+          java-version: '17'
+          distribution: 'zulu'
+          cache: 'maven'
 
       - name: Build
         id: build

+ 5 - 11
.github/workflows/release.yaml

@@ -17,18 +17,12 @@ jobs:
           git config user.name github-actions
           git config user.email github-actions@github.com
 
-      - name: Cache local Maven repository
-        uses: actions/cache@v3
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
-
-      - name: Set up JDK 1.13
-        uses: actions/setup-java@v1
+      - name: Set up JDK
+        uses: actions/setup-java@v3
         with:
-          java-version: 1.13
+          java-version: '17'
+          distribution: 'zulu'
+          cache: 'maven'
 
       - name: Build with Maven
         id: build

+ 7 - 6
documentation/project/contributing/prerequisites.md

@@ -6,7 +6,7 @@ machine for local development.
 Before you begin contributing you must have:
 
 * A GitHub account
-* `Java` 13 or newer
+* `Java` 17 or newer
 * `Git`
 * `Docker`
 
@@ -17,18 +17,19 @@ Before you begin contributing you must have:
 ```sh
 brew cask
 ```
-3. Install JDK 13 via Homebrew cask:
+3. Install Eclipse Temurin 17 via Homebrew cask:
 ```sh
-brew tap adoptopenjdk/openjdk
-brew install adoptopenjdk13
+brew tap homebrew/cask-versions
+brew install temurin17
 ```
 4. Verify Installation
 ```sh
 java -version
 ```
-Note : In case JAVA13 is not set as your default Java then you can consider to include JAVA13 in your PATH after installation
+Note : In case OpenJDK 17 is not set as your default Java, you can consider to include it in your `$PATH` after installation
 ```sh
-export PATH="/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/bin:$PATH
+export PATH="$(/usr/libexec/java_home -v 17)/bin:$PATH"
+export JAVA_HOME="$(/usr/libexec/java_home -v 17)"
 ```
 
 ## Tips

+ 2 - 3
kafka-ui-api/Dockerfile

@@ -1,7 +1,6 @@
-FROM alpine:3.16.2
+FROM azul/zulu-openjdk-alpine:17
 
-RUN apk add --no-cache openjdk13-jre libc6-compat gcompat \
-&& addgroup -S kafkaui && adduser -S kafkaui -G kafkaui
+RUN addgroup -S kafkaui && adduser -S kafkaui -G kafkaui
 
 USER kafkaui
 

+ 0 - 5
kafka-ui-api/pom.xml

@@ -262,10 +262,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
-                <version>${maven-compiler-plugin.version}</version>
                 <configuration>
-                    <source>${maven.compiler.source}</source>
-                    <target>${maven.compiler.target}</target>
                     <annotationProcessorPaths>
                         <path>
                             <groupId>org.mapstruct</groupId>
@@ -293,7 +290,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
-                <version>${maven-surefire-plugin.version}</version>
                 <configuration>
                     <argLine>@{argLine} --illegal-access=permit</argLine>
                 </configuration>
@@ -400,7 +396,6 @@
                     </plugin>
                     <plugin>
                         <artifactId>maven-resources-plugin</artifactId>
-                        <version>${maven-resources-plugin.version}</version>
                         <executions>
                             <execution>
                                 <id>copy-resources</id>

+ 0 - 2
kafka-ui-contract/pom.xml

@@ -175,7 +175,6 @@
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-clean-plugin</artifactId>
-                        <version>${maven-clean-plugin.version}</version>
                         <configuration>
                             <filesets>
                                 <fileset>
@@ -187,7 +186,6 @@
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-resources-plugin</artifactId>
-                        <version>${maven-resources-plugin.version}</version>
                         <executions>
                             <execution>
                                 <id>copy-resource-one</id>

+ 0 - 9
kafka-ui-e2e-checks/pom.xml

@@ -267,7 +267,6 @@
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-surefire-plugin</artifactId>
-                        <version>${maven.surefire-plugin.version}</version>
                         <configuration>
                             <skipTests>true</skipTests>
                         </configuration>
@@ -275,10 +274,6 @@
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-compiler-plugin</artifactId>
-                        <configuration>
-                            <source>${maven.compiler.source}</source>
-                            <target>${maven.compiler.target}</target>
-                        </configuration>
                     </plugin>
                 </plugins>
             </build>
@@ -319,10 +314,6 @@
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-compiler-plugin</artifactId>
-                        <configuration>
-                            <source>${maven.compiler.source}</source>
-                            <target>${maven.compiler.target}</target>
-                        </configuration>
                     </plugin>
                 </plugins>
             </build>

+ 29 - 3
pom.xml

@@ -11,8 +11,7 @@
     </modules>
 
     <properties>
-        <maven.compiler.source>13</maven.compiler.source>
-        <maven.compiler.target>13</maven.compiler.target>
+        <maven.compiler.release>17</maven.compiler.release>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 
         <spring-boot.version>2.6.8</spring-boot.version>
@@ -26,7 +25,7 @@
         <pnpm.version>v7.4.0</pnpm.version>
         <fabric8-maven-plugin.version>0.40.2</fabric8-maven-plugin.version>
         <frontend-maven-plugin.version>1.12.1</frontend-maven-plugin.version>
-        <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
+        <maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
         <maven-clean-plugin.version>3.1.0</maven-clean-plugin.version>
         <maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
         <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
@@ -87,6 +86,33 @@
         </pluginRepository>
     </pluginRepositories>
 
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <version>${maven-compiler-plugin.version}</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-resources-plugin</artifactId>
+                    <version>${maven-resources-plugin.version}</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>${maven-surefire-plugin.version}</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-clean-plugin</artifactId>
+                    <version>${maven-clean-plugin.version}</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+
     <groupId>com.provectus</groupId>
     <artifactId>kafka-ui</artifactId>
     <version>0.0.1-SNAPSHOT</version>