Skip to content

Commit 0320368

Browse files
committed
Upgrade build for Java 17 as base Java version
* Configure maven-enforcer-plugin to require Java 17 * Configure maven-enforcer-plugin to require maven 3.8+ as done in GeoServer. * Upgrade github actions workflows to use Java 17 * Remove cobertura-maven-plugin (modules/extension/xsd/**), as it is not compatible with Java 11 * Update maven-javadoc-plugin configuration to use legacyMode=true and not fail due to module-info.java not present. * Plugin version upgrades: * jacoco 0.8.7 -> 0.8.13 * maven-checkstyle-plugin 3.3.0 -> 3.6.0 * maven-compiler-plugin 3.11.0 -> 3.14.0 * maven-javadoc-plugin 3.6.3 -> 3.11.2 * Add .mvn/jvm.config with necessary --add-exports and --add-opens for internal jdk.compiler packages. This ensures that build-time tools and compiler plugins interacting with javac internals can function correctly under Java 17's module system. * Centralize maven plugin versions in the root pom's pluginManagement section.
1 parent 2693514 commit 0320368

File tree

7 files changed

+138
-66
lines changed

7 files changed

+138
-66
lines changed

.github/workflows/azure-integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323
strategy:
2424
matrix:
25-
java-version: [ 11, 17, 21 ]
25+
java-version: [ 17, 21 ]
2626
steps:
2727
- uses: actions/checkout@v4
2828
- uses: actions/setup-java@v3
@@ -57,7 +57,7 @@ jobs:
5757
- uses: actions/setup-java@v3
5858
with:
5959
distribution: 'temurin'
60-
java-version: 11
60+
java-version: 17
6161
cache: 'maven'
6262

6363
- name: Tests against Azure

.github/workflows/integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
runs-on: ubuntu-latest
1717

1818
steps:
19-
- name: Set up JDK 11
19+
- name: Set up JDK 17
2020
uses: actions/setup-java@v3
2121
with:
22-
java-version: 11
22+
java-version: 17
2323
distribution: 'temurin'
2424
- uses: actions/checkout@v4
2525
- name: Maven repository caching

.github/workflows/linux.yml

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,6 @@ env:
1010
MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=3 -Xmx512m -Djava.awt.headless=true -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS
1111

1212
jobs:
13-
openjdk11:
14-
runs-on: [ubuntu-22.04]
15-
steps:
16-
- uses: actions/checkout@v4
17-
- name: Set up JDK 11
18-
uses: actions/setup-java@v3
19-
with:
20-
java-version: 11
21-
distribution: 'temurin'
22-
- name: Maven repository caching
23-
uses: actions/cache@v3
24-
with:
25-
path: ~/.m2/repository
26-
key: gwc-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
27-
restore-keys: |
28-
${{ runner.os }}-maven-
29-
- name: Build with Maven
30-
run: mvn -B clean install -Dspotless.apply.skip=true -Dall -T2 --file geowebcache/pom.xml
31-
- name: Remove SNAPSHOT jars from repository
32-
run: |
33-
find .m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}
34-
3513
openjdk17:
3614
runs-on: [ubuntu-22.04]
3715
steps:
@@ -80,10 +58,10 @@ jobs:
8058
runs-on: [ubuntu-22.04]
8159
steps:
8260
- uses: actions/checkout@v4
83-
- name: Set up JDK 11
61+
- name: Set up JDK 17
8462
uses: actions/setup-java@v3
8563
with:
86-
java-version: 11
64+
java-version: 17
8765
distribution: 'temurin'
8866
- name: Maven repository caching
8967
uses: actions/cache@v3

.github/workflows/macos.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v4
16-
- name: Set up JDK 11
16+
- name: Set up JDK 17
1717
uses: actions/setup-java@v3
1818
with:
19-
java-version: 11
19+
java-version: 17
2020
distribution: 'temurin'
2121
- name: Maven repository caching
2222
uses: actions/cache@v3

.github/workflows/windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v4
16-
- name: Set up JDK 11
16+
- name: Set up JDK 17
1717
uses: actions/setup-java@v3
1818
with:
19-
java-version: 11
19+
java-version: 17
2020
distribution: 'temurin'
2121
- name: Maven repository caching
2222
uses: actions/cache@v3

geowebcache/pom.xml

Lines changed: 128 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,6 @@
511511

512512
<pluginManagement>
513513
<plugins>
514-
<plugin>
515-
<groupId>org.codehaus.mojo</groupId>
516-
<artifactId>cobertura-maven-plugin</artifactId>
517-
<version>2.0</version>
518-
</plugin>
519514
<plugin>
520515
<artifactId>maven-failsafe-plugin</artifactId>
521516
<version>3.3.1</version>
@@ -539,13 +534,105 @@
539534
<skipTests>${skipITs}</skipTests>
540535
</configuration>
541536
</plugin>
537+
538+
<plugin>
539+
<groupId>org.codehaus.mojo</groupId>
540+
<artifactId>buildnumber-maven-plugin</artifactId>
541+
<version>1.4</version>
542+
</plugin>
543+
544+
<plugin>
545+
<artifactId>maven-jar-plugin</artifactId>
546+
<version>2.4</version>
547+
</plugin>
548+
549+
<plugin>
550+
<groupId>org.apache.maven.plugins</groupId>
551+
<artifactId>maven-enforcer-plugin</artifactId>
552+
<version>3.5.0</version>
553+
</plugin>
554+
555+
<plugin>
556+
<artifactId>maven-compiler-plugin</artifactId>
557+
<version>3.14.0</version>
558+
</plugin>
559+
560+
<plugin>
561+
<artifactId>maven-source-plugin</artifactId>
562+
<version>2.2.1</version>
563+
</plugin>
564+
565+
<plugin>
566+
<artifactId>maven-surefire-plugin</artifactId>
567+
<version>2.22.1</version>
568+
</plugin>
569+
570+
<plugin>
571+
<groupId>pl.project13.maven</groupId>
572+
<artifactId>git-commit-id-plugin</artifactId>
573+
<version>4.9.10</version>
574+
</plugin>
575+
576+
<plugin>
577+
<artifactId>maven-assembly-plugin</artifactId>
578+
<version>2.2</version>
579+
</plugin>
580+
581+
<plugin>
582+
<groupId>com.diffplug.spotless</groupId>
583+
<artifactId>spotless-maven-plugin</artifactId>
584+
<version>2.43.0</version>
585+
</plugin>
586+
587+
<plugin>
588+
<groupId>com.github.ekryd.sortpom</groupId>
589+
<artifactId>sortpom-maven-plugin</artifactId>
590+
<version>2.15.0</version>
591+
</plugin>
592+
593+
<plugin>
594+
<groupId>org.commonjava.maven.plugins</groupId>
595+
<artifactId>directory-maven-plugin</artifactId>
596+
<version>0.3.1</version>
597+
</plugin>
598+
599+
<plugin>
600+
<artifactId>maven-war-plugin</artifactId>
601+
<version>3.4.0</version>
602+
</plugin>
603+
604+
<plugin>
605+
<groupId>org.eclipse.jetty</groupId>
606+
<artifactId>jetty-maven-plugin</artifactId>
607+
<version>9.4.14.v20181114</version>
608+
</plugin>
609+
610+
<plugin>
611+
<artifactId>maven-javadoc-plugin</artifactId>
612+
<version>3.8.0</version>
613+
</plugin>
614+
615+
<plugin>
616+
<artifactId>maven-pmd-plugin</artifactId>
617+
<version>3.22.0</version>
618+
</plugin>
619+
620+
<plugin>
621+
<groupId>com.github.spotbugs</groupId>
622+
<artifactId>spotbugs-maven-plugin</artifactId>
623+
<version>4.8.2.0</version>
624+
</plugin>
625+
626+
<plugin>
627+
<artifactId>maven-checkstyle-plugin</artifactId>
628+
<version>3.6.0</version>
629+
</plugin>
542630
</plugins>
543631
</pluginManagement>
544632
<plugins>
545633
<plugin>
546634
<groupId>org.codehaus.mojo</groupId>
547635
<artifactId>buildnumber-maven-plugin</artifactId>
548-
<version>1.4</version>
549636
<executions>
550637
<execution>
551638
<phase>validate</phase>
@@ -566,7 +653,6 @@
566653

567654
<plugin>
568655
<artifactId>maven-jar-plugin</artifactId>
569-
<version>2.4</version>
570656
<executions>
571657
<execution>
572658
<phase>package</phase>
@@ -593,20 +679,50 @@
593679
</configuration>
594680
</plugin>
595681

682+
<plugin>
683+
<groupId>org.apache.maven.plugins</groupId>
684+
<artifactId>maven-enforcer-plugin</artifactId>
685+
<executions>
686+
<execution>
687+
<id>enforce</id>
688+
<!-- Enforcing a minimum Maven version is crucial to ensure that:
689+
- Plugin version resolution works as expected: Different Maven versions
690+
may resolve plugin versions differently due to changes in the default
691+
lifecycle mappings, dependency resolution behavior, and plugin inheritance.
692+
- Features and bug fixes required by newer plugins are available: For example,
693+
some plugins (e.g., surefire-plugin 3.x) require Maven 3.6+ or 3.8+.
694+
- Consistent builds across environments: Without enforcing a Maven version,
695+
developers or CI/CD pipelines using different Maven versions may face
696+
unexpected build failures or inconsistencies.
697+
-->
698+
<goals>
699+
<goal>enforce</goal>
700+
</goals>
701+
<configuration>
702+
<rules>
703+
<requireMavenVersion>
704+
<version>[3.8,4.0)</version>
705+
<message>You must use Maven 3.8 or higher to build this project.</message>
706+
</requireMavenVersion>
707+
<requireJavaVersion>
708+
<version>[17,)</version>
709+
</requireJavaVersion>
710+
</rules>
711+
</configuration>
712+
</execution>
713+
</executions>
714+
</plugin>
596715
<plugin>
597716
<artifactId>maven-compiler-plugin</artifactId>
598-
<version>3.13.0</version>
599717
<configuration>
600-
<source>11</source>
601-
<target>11</target>
718+
<release>17</release>
602719
<encoding>UTF-8</encoding>
603720
<parameters>true</parameters>
604721
</configuration>
605722
</plugin>
606723

607724
<plugin>
608725
<artifactId>maven-source-plugin</artifactId>
609-
<version>2.2.1</version>
610726
<executions>
611727
<execution>
612728
<id>attach-sources</id>
@@ -622,7 +738,6 @@
622738

623739
<plugin>
624740
<artifactId>maven-surefire-plugin</artifactId>
625-
<version>2.22.1</version>
626741
<configuration>
627742
<forkCount>1</forkCount>
628743
<reuseForks>false</reuseForks>
@@ -639,7 +754,6 @@
639754
<plugin>
640755
<groupId>pl.project13.maven</groupId>
641756
<artifactId>git-commit-id-plugin</artifactId>
642-
<version>4.9.10</version>
643757
<executions>
644758
<execution>
645759
<goals>
@@ -657,7 +771,6 @@
657771

658772
<plugin>
659773
<artifactId>maven-assembly-plugin</artifactId>
660-
<version>2.2</version>
661774
<configuration>
662775
<!--descriptorRefs>
663776
<descriptorRef>project</descriptorRef>
@@ -675,7 +788,6 @@
675788
<plugin>
676789
<groupId>com.diffplug.spotless</groupId>
677790
<artifactId>spotless-maven-plugin</artifactId>
678-
<version>2.43.0</version>
679791
<executions>
680792
<execution>
681793
<phase>validate</phase>
@@ -701,7 +813,6 @@
701813
<plugin>
702814
<groupId>com.github.ekryd.sortpom</groupId>
703815
<artifactId>sortpom-maven-plugin</artifactId>
704-
<version>2.15.0</version>
705816
<executions>
706817
<execution>
707818
<phase>verify</phase>
@@ -723,7 +834,6 @@
723834
<plugin>
724835
<groupId>org.commonjava.maven.plugins</groupId>
725836
<artifactId>directory-maven-plugin</artifactId>
726-
<version>0.3.1</version>
727837
<executions>
728838
<execution>
729839
<id>directories</id>
@@ -742,21 +852,11 @@
742852

743853
<reporting>
744854
<plugins>
745-
<plugin>
746-
<groupId>org.codehaus.mojo</groupId>
747-
<artifactId>cobertura-maven-plugin</artifactId>
748-
<configuration>
749-
<formats>
750-
<format>html</format>
751-
<format>xml</format>
752-
</formats>
753-
</configuration>
754-
</plugin>
755855
<!-- javadoc -->
756856
<plugin>
757857
<artifactId>maven-javadoc-plugin</artifactId>
758858
<configuration>
759-
<source>11</source>
859+
<release>17</release>
760860
<version>false</version>
761861
<noqualifier>all</noqualifier>
762862
<maxmemory>256M</maxmemory>
@@ -800,7 +900,6 @@
800900
<plugins>
801901
<plugin>
802902
<artifactId>maven-pmd-plugin</artifactId>
803-
<version>3.22.0</version>
804903
<executions>
805904
<execution>
806905
<goals>
@@ -860,7 +959,6 @@
860959
<plugins>
861960
<plugin>
862961
<artifactId>maven-compiler-plugin</artifactId>
863-
<version>3.8.0</version>
864962
<configuration>
865963
<fork>false</fork>
866964
<compilerArgs>
@@ -894,7 +992,6 @@
894992
<plugin>
895993
<groupId>com.github.spotbugs</groupId>
896994
<artifactId>spotbugs-maven-plugin</artifactId>
897-
<version>4.8.2.0</version>
898995
<executions>
899996
<execution>
900997
<goals>
@@ -926,7 +1023,6 @@
9261023
<plugins>
9271024
<plugin>
9281025
<artifactId>maven-checkstyle-plugin</artifactId>
929-
<version>3.1.1</version>
9301026
<executions>
9311027
<execution>
9321028
<goals>

geowebcache/web/pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@
157157
<plugins>
158158
<plugin>
159159
<artifactId>maven-war-plugin</artifactId>
160-
<version>3.2.3</version>
161160
<executions>
162161
<execution>
163162
<phase>install</phase>
@@ -175,7 +174,6 @@
175174
<plugin>
176175
<groupId>org.eclipse.jetty</groupId>
177176
<artifactId>jetty-maven-plugin</artifactId>
178-
<version>9.4.14.v20181114</version>
179177
<configuration>
180178
<webApp>
181179
<contextPath>/geowebcache</contextPath>

0 commit comments

Comments
 (0)