Skip to content

Commit bd02e65

Browse files
authored
[Java] Update Java version in GitHub actions (OpenAPITools#18513)
* Update Java version in Github actions * Generate samples * [java] Upgrade Gradle wrapper to 8.7 * Generate samples * [Java] Add resttemplate-jakarta to CI * Upgrade CI machines to ubuntu-2204:2024.04.4 which use Java 21 * Change CI machines to ubuntu-2204:2024.01.1 which use Java 17 * Change CI machines to ubuntu-2004:2024.01.1 * [ruby] Update Gemfile.locks * Use gradle wrapper for samples-java-client-jdk17
1 parent 8faa77c commit bd02e65

File tree

288 files changed

+7303
-6000
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

288 files changed

+7303
-6000
lines changed

.circleci/config.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ commands: # a reusable command with parameters
141141
jobs:
142142
node0:
143143
machine:
144-
image: ubuntu-2004:202201-02
144+
image: ubuntu-2004:2024.01.1
145145
working_directory: ~/OpenAPITools/openapi-generator
146146
shell: /bin/bash --login
147147
environment:
@@ -154,7 +154,7 @@ jobs:
154154
nodeNo: "0"
155155
node1:
156156
machine:
157-
image: ubuntu-2004:202201-02
157+
image: ubuntu-2004:2024.01.1
158158
working_directory: ~/OpenAPITools/openapi-generator
159159
shell: /bin/bash --login
160160
environment:
@@ -167,7 +167,7 @@ jobs:
167167
nodeNo: "1"
168168
node2:
169169
machine:
170-
image: ubuntu-2004:202201-02
170+
image: ubuntu-2004:2024.01.1
171171
working_directory: ~/OpenAPITools/openapi-generator
172172
shell: /bin/bash --login
173173
environment:
@@ -180,7 +180,7 @@ jobs:
180180
nodeNo: "2"
181181
node3:
182182
machine:
183-
image: ubuntu-2004:202201-02
183+
image: ubuntu-2004:2024.01.1
184184
working_directory: ~/OpenAPITools/openapi-generator
185185
shell: /bin/bash --login
186186
environment:

.github/workflows/gradle-test.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- 'samples/client/petstore/java/**'
1111
- 'samples/openapi3/client/petstore/java/**'
1212
env:
13-
GRADLE_VERSION: 7.2
13+
GRADLE_VERSION: 8.7
1414

1515
jobs:
1616
build:

.github/workflows/samples-java-client-jdk17.yaml

+20-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,27 @@ jobs:
3434
path: |
3535
~/.m2
3636
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
37+
3738
- name: Build with Maven
3839
working-directory: ${{ matrix.sample }}
3940
run: mvn clean package
40-
- name: Build with Gradle
41+
42+
- name: Cache gradle dependencies
43+
uses: actions/cache@v4
44+
env:
45+
cache-name: gradle-caches
46+
with:
47+
path: ~/.gradle/caches
48+
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }}
49+
50+
- name: Cache gradle wrapper
51+
uses: actions/cache@v4
52+
env:
53+
cache-name: gradle-wrapper
54+
with:
55+
path: ~/.gradle/wrapper
56+
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
57+
58+
- name: Build
4159
working-directory: ${{ matrix.sample }}
42-
run: gradle clean build
60+
run: ./gradlew build -x test

CI/circle_parallel.sh

+1
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,6 @@ else
110110
(cd samples/client/petstore/java/resteasy && mvn integration-test)
111111
(cd samples/client/petstore/java-micronaut-client && mvn integration-test)
112112
(cd samples/client/petstore/java/apache-httpclient && mvn integration-test)
113+
(cd samples/client/petstore/java/resttemplate-jakarta && mvn integration-test)
113114

114115
fi
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

modules/openapi-generator/src/main/resources/Java/gradlew.bat.mustache

+20-17
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@rem limitations under the License.
1515
@rem
1616

17-
@if "%DEBUG%" == "" @echo off
17+
@if "%DEBUG%"=="" @echo off
1818
@rem ##########################################################################
1919
@rem
2020
@rem Gradle startup script for Windows
@@ -25,28 +25,29 @@
2525
if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
28-
if "%DIRNAME%" == "" set DIRNAME=.
28+
if "%DIRNAME%"=="" set DIRNAME=.
29+
@rem This is normally unused
2930
set APP_BASE_NAME=%~n0
3031
set APP_HOME=%DIRNAME%
3132

3233
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
3334
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
3435

3536
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36-
set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"
37+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
3738

3839
@rem Find java.exe
3940
if defined JAVA_HOME goto findJavaFromJavaHome
4041

4142
set JAVA_EXE=java.exe
4243
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto execute
44+
if %ERRORLEVEL% equ 0 goto execute
4445

45-
echo.
46-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47-
echo.
48-
echo Please set the JAVA_HOME variable in your environment to match the
49-
echo location of your Java installation.
46+
echo. 1>&2
47+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
48+
echo. 1>&2
49+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
50+
echo location of your Java installation. 1>&2
5051

5152
goto fail
5253

@@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5657

5758
if exist "%JAVA_EXE%" goto execute
5859

59-
echo.
60-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61-
echo.
62-
echo Please set the JAVA_HOME variable in your environment to match the
63-
echo location of your Java installation.
60+
echo. 1>&2
61+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
62+
echo. 1>&2
63+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
64+
echo location of your Java installation. 1>&2
6465

6566
goto fail
6667

@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
7576

7677
:end
7778
@rem End local scope for the variables with windows NT shell
78-
if "%ERRORLEVEL%"=="0" goto mainEnd
79+
if %ERRORLEVEL% equ 0 goto mainEnd
7980

8081
:fail
8182
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
8283
rem the _cmd.exe /c_ return code!
83-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84-
exit /b 1
84+
set EXIT_CODE=%ERRORLEVEL%
85+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
86+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87+
exit /b %EXIT_CODE%
8588

8689
:mainEnd
8790
if "%OS%"=="Windows_NT" endlocal

0 commit comments

Comments
 (0)