From a7f4531bfaf4e7ca93fea518b5c1734cd6ffdc1a Mon Sep 17 00:00:00 2001 From: Elango Cheran Date: Tue, 17 Jan 2023 19:13:01 +0000 Subject: [PATCH] ICU-12811 Fix localespi tests when run by Maven on Java 8 See #2283 --- .github/workflows/icu_ci.yml | 22 ++++-- .../maven-build/maven-icu4j-localespi/pom.xml | 77 +++++++++++++++++-- icu4j/maven-build/pom.xml | 31 ++++++++ 3 files changed, 116 insertions(+), 14 deletions(-) diff --git a/.github/workflows/icu_ci.yml b/.github/workflows/icu_ci.yml index f83c9b7e486..1f16614d39e 100644 --- a/.github/workflows/icu_ci.yml +++ b/.github/workflows/icu_ci.yml @@ -60,13 +60,17 @@ jobs: # Run `test` to execute unit tests and ensure it is possible for tests to run even without packaging submodule # dependencies as jar files - java8-icu4j-test-maven: - name: Run unit tests with Maven using JDK 8 + icu4j-test-maven: + name: Run unit tests with Maven for Java version runs-on: ubuntu-latest # Make this unit test target job depend on a later phase target job to prevent race condition when # trying to persist the Maven cache to the Github cache, knowing that artifacts needed for # the later phase `verify` are a superset of the artifacts needed for the earlier phase `test`. - needs: java8-icu4j-verify-maven + needs: icu4j-verify-maven + strategy: + fail-fast: false + matrix: + java-version: [ '8', '11' ] steps: - name: Checkout and setup uses: actions/checkout@v2 @@ -77,7 +81,7 @@ jobs: - uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: '8' + java-version: ${{ matrix.java-version }} cache: maven - name: Run Maven test run: | @@ -85,9 +89,13 @@ jobs: mvn --batch-mode test # Run `verify` to ensure that `package` (creating .jar files) and `integration-test` (special setup for localespi tests) work - java8-icu4j-verify-maven: - name: Run integration tests with Maven using JDK 8 + icu4j-verify-maven: + name: Run integration tests with Maven for Java version runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + java-version: [ '8', '11' ] steps: - name: Checkout and setup uses: actions/checkout@v2 @@ -98,7 +106,7 @@ jobs: - uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: '8' + java-version: ${{ matrix.java-version }} cache: maven # The Maven `verify` phase causes the following to happen first, and in order: # build/compile (`compile`), unit tests (`test`), Jar building (`package`), diff --git a/icu4j/maven-build/maven-icu4j-localespi/pom.xml b/icu4j/maven-build/maven-icu4j-localespi/pom.xml index bccecd08527..70b62fdd494 100644 --- a/icu4j/maven-build/maven-icu4j-localespi/pom.xml +++ b/icu4j/maven-build/maven-icu4j-localespi/pom.xml @@ -130,6 +130,49 @@ + + + org.apache.maven.plugins + maven-dependency-plugin + + + it-test-copy-localespi-extension-jars + integration-test + + copy + + + + + ${project.groupId} + icu4j + ${project.version} + ${project.packaging} + + + ${project.groupId} + icu4j-localespi + ${project.version} + ${project.packaging} + + + + ${java.io.tmpdir}/ext-test-jars + + + + + org.apache.maven.plugins maven-failsafe-plugin @@ -150,9 +193,17 @@ **/*ITCase.java - - - + - ${project.build.directory} - + ${localespi-tests.jvm.args} + + - SPI,JRE + + ${localespi-tests.locale-providers} diff --git a/icu4j/maven-build/pom.xml b/icu4j/maven-build/pom.xml index 3c15b16926f..f1f0496de0a 100644 --- a/icu4j/maven-build/pom.xml +++ b/icu4j/maven-build/pom.xml @@ -148,6 +148,37 @@ + + + + localespi-tests-java8 + + (,8] + + + -Djava.ext.dirs="${java.io.tmpdir}/ext-test-jars" + + + + + + localespi-tests-java9 + + [9,) + + + + CLDR,COMPAT,SPI + + + +