Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 0c3d5d3

Browse files
authored
Merge pull request #48 from JackOehling/TEJ-2586
TEJ-2586: Compile TCL Regex Java with Java 21 and target Java 11
2 parents 4fbb9eb + 651e9c7 commit 0c3d5d3

File tree

2 files changed

+65
-14
lines changed

2 files changed

+65
-14
lines changed

Jenkinsfile

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,64 @@
11
env.project = "tcl-regex-java"
22

3-
properties([
4-
parameters([
3+
def properties = [
4+
buildParams: [
55
booleanParam(
66
name: 'release',
77
defaultValue: false,
88
description: 'Release the project'
9-
),
9+
),
1010
string(
1111
name: 'version',
1212
defaultValue: '',
1313
description: 'Version to release, or empty to use the default next version'
14-
)
15-
])
16-
])
14+
),
15+
string(
16+
name: 'buildJdk',
17+
defaultValue: 'openjdk-21',
18+
description: 'The JDK to use for building',
19+
),
20+
string(
21+
name: 'testJdks',
22+
defaultValue: 'openjdk-11 openjdk-17',
23+
description: 'The JDKs to use for tests, separated by spaces',
24+
),
25+
],
26+
]
1727

1828
standardProperties(properties)
1929

20-
def options = [
21-
mavenOptionsExtra: [jdk: 'openjdk-17'],
30+
def afterBuildClosures = []
31+
32+
def buildOptions = [
33+
mavenOptionsExtra: [jdk: params.buildJdk],
34+
afterBuild: { afterBuildClosures.each { it() } },
2235
]
2336

24-
options.afterBuild = {
25-
withMaven([jdk: params.testJdk]) {
26-
withSonarQubeEnv() {
27-
sh "mvn -D sonar.login=${env.SONAR_AUTH_TOKEN} sonar:sonar -D sonar.host.url=${env.SONAR_HOST_URL}"
37+
38+
afterBuildClosures += {
39+
stage('sonar-report') {
40+
withMaven() {
41+
withSonarQubeEnv() {
42+
sh "mvn -D sonar.login=${env.SONAR_AUTH_TOKEN} sonar:sonar -D sonar.host.url=${env.SONAR_HOST_URL}"
43+
}
44+
}
45+
}
46+
}
47+
48+
if (params.testJdks) {
49+
afterBuildClosures += {
50+
params.testJdks.split(' ').each { testJdk ->
51+
stage("Tests in ${testJdk}") {
52+
withMaven([
53+
jdk: testJdk,
54+
]) {
55+
sh 'mvn -B -e -D enforcer.skip -D maven.javadoc.skip verify'
56+
}
57+
}
2858
}
2959
}
3060
}
3161

32-
options.buildArgs = ' '
62+
buildOptions.buildArgs = ' '
3363

34-
standardBuildSteps(options)
64+
standardBuildSteps(buildOptions)

pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,27 @@
157157
</execution>
158158
</executions>
159159
</plugin>
160+
<plugin>
161+
<groupId>org.apache.maven.plugins</groupId>
162+
<artifactId>maven-enforcer-plugin</artifactId>
163+
<version>${maven-enforcer-plugin.version}</version>
164+
<executions>
165+
<execution>
166+
<id>enforce-versions</id>
167+
<goals>
168+
<goal>enforce</goal>
169+
</goals>
170+
<phase>validate</phase>
171+
<configuration>
172+
<rules>
173+
<requireJavaVersion>
174+
<version>[21,22)</version>
175+
</requireJavaVersion>
176+
</rules>
177+
</configuration>
178+
</execution>
179+
</executions>
180+
</plugin>
160181
</plugins>
161182
</build>
162183
<reporting>

0 commit comments

Comments
 (0)