Skip to content

Commit b184feb

Browse files
authored
feat: add support for Java 17 and Spring 6, restructure project (#264)
- Add support for Java 17 and Spring Framework 6 - Restructure project into a multi-module Maven project - Move smoke tests into their own module, `smoke-tests` for testing compatibility with different Java versions - Update README with compatibility notes
1 parent 6728ab0 commit b184feb

File tree

13 files changed

+619
-373
lines changed

13 files changed

+619
-373
lines changed

.github/workflows/build.yml

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,52 @@ on:
88
branches: [ main ]
99

1010
jobs:
11+
1112
build:
12-
name: "Build with ${{ matrix.java }}"
13+
name: "Main build"
14+
15+
runs-on: ubuntu-latest
16+
outputs:
17+
candidate_version_revision: ${{ steps.candidate_version.outputs.candidate_version_revision }}
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Setup java
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: 17
26+
distribution: 'temurin'
27+
28+
- name: Cache local Maven repository
29+
uses: actions/cache@v4
30+
with:
31+
path: ~/.m2/repository
32+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ github.run_id }}
33+
restore-keys: |
34+
${{ runner.os }}-maven-
35+
36+
- name: Retrieve current version
37+
id: current_version
38+
run: echo "project_version=$(mvn help:evaluate -Dexpression=project.version -Dchangelist= -q -DforceStdout)" >> "$GITHUB_OUTPUT"
39+
40+
- name: Compute release candidate revision version
41+
id: candidate_version
42+
run: echo "candidate_version_revision=${{ steps.current_version.outputs.project_version }}.$GITHUB_RUN_ID" >> "$GITHUB_OUTPUT"
43+
44+
- name: Build candidate version
45+
run: mvn -B -pl '!smoke-tests' clean install -Drevision=${{ steps.candidate_version.outputs.candidate_version_revision }} -Dchangelist=-rc
46+
47+
smoke-tests:
48+
name: "Run smoke tests with Java ${{ matrix.java }} for spring-mvc-test-utils ${{ needs.build.outputs.candidate_version_revision }}-rc version"
1349
strategy:
1450
matrix:
15-
java: [ 11, 17 ]
51+
java: [ 17, 21 ]
1652

1753
runs-on: ubuntu-latest
54+
needs: build
55+
env:
56+
candidate_version_revision: ${{ needs.build.outputs.candidate_version_revision }}
1857

1958
steps:
2059
- uses: actions/checkout@v4
@@ -24,7 +63,14 @@ jobs:
2463
with:
2564
java-version: ${{ matrix.java }}
2665
distribution: 'temurin'
27-
cache: 'maven'
2866

29-
- name: Build with Maven
30-
run: mvn -B verify
67+
- name: Cache local Maven repository
68+
uses: actions/cache@v4
69+
with:
70+
path: ~/.m2/repository
71+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ github.run_id }}
72+
restore-keys: |
73+
${{ runner.os }}-maven-
74+
75+
- name: Run smoke tests with Java ${{ matrix.java }} for spring-mvc-test-utils ${{ needs.build.outputs.candidate_version_revision }}-rc version
76+
run: mvn -B -pl 'smoke-tests' -Dspring-mvc-test-utils.version=${candidate_version_revision}-rc -Djava.version=${{ matrix.java }} clean verify

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.florianlopes/spring-mvc-test-utils/badge.svg)](https://search.maven.org/#artifactdetails%7Cio.florianlopes%7Cspring-mvc-test-utils%7C3.2.0%7Cjar)
66
[![Build Status](https://travis-ci.org/f-lopes/spring-mvc-test-utils.svg?branch=develop)](https://travis-ci.org/f-lopes/spring-mvc-test-utils)
7-
[![codecov](https://codecov.io/gh/f-lopes/spring-mvc-test-utils/branch/master/graph/badge.svg?token=2yY70RB1tw)](https://codecov.io/gh/f-lopes/spring-mvc-test-utils)
7+
[![codecov](https://codecov.io/gh/f-lopes/spring-mvc-test-utils/branch/main/graph/badge.svg?token=2yY70RB1tw)](https://codecov.io/gh/f-lopes/spring-mvc-test-utils)
88

99
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/1e521e339dc446328b7ccc52faaa7648)](https://www.codacy.com/app/f-lopes/spring-mvc-test-utils?utm_source=github.com&utm_medium=referral&utm_content=f-lopes/spring-mvc-test-utils&utm_campaign=badger)
1010
[![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/f-lopes/spring-mvc-test-utils.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/f-lopes/spring-mvc-test-utils/context:java)
@@ -28,7 +28,13 @@ Add this dependency to your `pom.xml` file:
2828
</dependency>
2929
```
3030

31-
**Note:** since version `3.0.0`, `Java 8` is no longer supported, `Java 11` is the minimum supported version.
31+
_**Note:** since version `4.0.0`, `Java 11` is no longer supported, `Java 17` is the minimum supported version._
32+
33+
_This library is tested with Spring Framework `6.1.12` along with Java `17` and `21` (
34+
see [smoke-tests](https://github.com/f-lopes/spring-mvc-test-utils/tree/main/smoke-tests/src/tests/java/io/florianlopes/spring/test/web/servlet/request/MockMvcRequestBuilderUtilsSmokeTests.java)
35+
and [build.yml](https://github.com/f-lopes/spring-mvc-test-utils/blob/main/.github/workflows/build.yml#L15) workflow)_
36+
37+
---
3238

3339
```MockMvcRequestBuilderUtils.postForm("/url", formObject);```
3440

@@ -73,7 +79,8 @@ mockMvc.perform(put("/users").with(MockMvcRequestBuilderUtils.form(addUserForm))
7379

7480
### Register property editor(s)
7581

76-
This tool relies on default Spring's property editors (see https://github.com/spring-projects/spring-framework/blob/master/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java#L200).
82+
This tool relies on default Spring's property editors (
83+
see https://github.com/spring-projects/spring-framework/blob/main/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java#L200).
7784

7885
If you want to override one of those registered by default, simple use the `MockMvcRequestBuilderUtils.registerPropertyEditor(...)` method:
7986
```
@@ -120,9 +127,9 @@ Feel free to contribute using this guide:
120127
```git branch -b my-feature```
121128
5. Commit your changes (and squash them if necessary using `git rebase -i` or `git add -p`)
122129
6. Pull the latest changes from the original repository
123-
```git checkout master && git pull --rebase upstream master```
124-
7. Rebase master branch with your feature
125-
```git checkout my-feature && git rebase master```
130+
```git checkout main && git pull --rebase upstream main```
131+
7. Rebase main branch with your feature
132+
```git checkout my-feature && git rebase main```
126133
Solve any existing conflicts
127134
8. Push your changes and create a PR on GitHub
128135
```git push -u origin my-feature```

0 commit comments

Comments
 (0)