Skip to content

Commit 29dbcec

Browse files
committed
Fixing matrix failures for Java17
1 parent c25a220 commit 29dbcec

File tree

8 files changed

+47
-30
lines changed

8 files changed

+47
-30
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ jobs:
5656
- name: Set up Java 21 and ${{ matrix.non_ea_java_version }}, ${{ matrix.java_distribution }}
5757
uses: actions/setup-java@v4
5858
with:
59-
# The latest one will be the default, so we use Java 21 for launching Gradle
59+
# Install multiple Java versions:
60+
# - Test version (11, 17, 21, or 24/25): Used to run TestNG tests
61+
# - Java 21: Default for running Gradle, building TestNG, and compiling build-logic (the last one in the list becomes default)
6062
java-version: |
6163
${{ matrix.non_ea_java_version }}
6264
21
@@ -83,7 +85,7 @@ jobs:
8385
properties: |
8486
testng.test.extra.jvmargs=${{ matrix.testExtraJvmArgs }}
8587
testDisableCaching=${{ matrix.testDisableCaching }}
86-
jdkBuildVersion=17
88+
jdkBuildVersion=21
8789
jdkTestVersion=${{ matrix.java_version }}
8890
jdkTestVendor=${{ matrix.java_vendor }}
8991
# We provision JDKs with GitHub Actions for caching purposes, so Gradle should rather fail in case JDK is not found

build-logic-commons/gradle-plugin/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ dependencies {
1515
}
1616

1717
// We need to figure out a version that is supported by the current JVM, and by the Kotlin Gradle plugin
18-
// So we settle on 17 or 11 if the current JVM supports it
19-
listOf(17, 11)
18+
// We use Java 21 (our build JDK) or fall back to 11 (our target compatibility) if running on an older JVM
19+
listOf(21, 11)
2020
.firstOrNull { JavaVersion.toVersion(it) <= JavaVersion.current() }
2121
?.let { buildScriptJvmTarget ->
2222
java {

build-logic-commons/gradle-plugin/src/main/kotlin/build-logic.kotlin-dsl-gradle-plugin.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ tasks.validatePlugins {
99
}
1010

1111
// We need to figure out a version that is supported by the current JVM, and by the Kotlin Gradle plugin
12-
// So we settle on 17 or 11 if the current JVM supports it
13-
listOf(17, 11)
12+
// We use Java 21 (our build JDK) or fall back to 11 (our target compatibility) if running on an older JVM
13+
listOf(21, 11)
1414
.firstOrNull { JavaVersion.toVersion(it) <= JavaVersion.current() }
1515
?.let { buildScriptJvmTarget ->
1616
java {

build-logic/jvm/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ dependencies {
77
api(projects.basics)
88
api(projects.codeQuality)
99
api("com.github.vlsi.gradle-extensions:com.github.vlsi.gradle-extensions.gradle.plugin:1.90")
10-
api("org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.6.21")
10+
api("org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:2.3.0")
1111
}

build-logic/jvm/src/main/kotlin/testng.kotlin-library.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ plugins {
66
}
77

88
dependencies {
9-
testImplementation(platform("org.jetbrains.kotlin:kotlin-bom:1.6.20"))
9+
testImplementation(platform("org.jetbrains.kotlin:kotlin-bom:2.3.0"))
1010
testImplementation("org.jetbrains.kotlin:kotlin-stdlib")
1111
}
1212

1313
tasks.withType<KotlinCompile>().configureEach {
14-
kotlinOptions {
15-
freeCompilerArgs += "-Xjvm-default=all"
14+
compilerOptions {
15+
freeCompilerArgs.add("-Xjvm-default=all")
1616
val jdkRelease = buildParameters.targetJavaVersion.toString()
17-
freeCompilerArgs += "-Xjdk-release=$jdkRelease"
18-
kotlinOptions.jvmTarget = jdkRelease
17+
freeCompilerArgs.add("-Xjdk-release=$jdkRelease")
18+
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.fromTarget(jdkRelease))
1919
}
2020
}

docs/BUILD_SYSTEM.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ TestNG uses the new **Maven Central Portal API** (replacing the legacy OSSRH sys
204204
│ Root Project (build.gradle.kts) │
205205
│ │
206206
│ plugins { │
207-
│ id("com.gradleup.nmcp.aggregation") version "1.0.2" │
207+
│ id("com.gradleup.nmcp.aggregation") version "1.0.3" │
208208
│ } │
209209
│ │
210210
│ nmcpAggregation { │

docs/RELEASE_PROCESS.md

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,16 @@ You need:
8989

9090
### Required Secrets (Already Configured)
9191

92-
The following secrets must be configured in GitHub repository settings:
92+
The following secrets must be configured in GitHub repository settings. The GitHub Actions workflows automatically map these secrets to the environment variables required by the build:
9393

94-
| Secret Name | Description | Where to Get |
95-
|-------------|-------------|--------------|
96-
| `NEXUS_USERNAME` | Central Portal username/token | https://central.sonatype.com/ → Generate User Token |
97-
| `NEXUS_PASSWORD` | Central Portal password/token | https://central.sonatype.com/ → Generate User Token |
98-
| `GPG_PRIVATE_KEY` | PGP private key for signing | Your PGP keyring |
99-
| `GPG_PASSPHRASE` | PGP key passphrase | Your PGP key passphrase |
94+
| GitHub Secret Name | Maps to Environment Variable | Description | Where to Get |
95+
|-------------------|------------------------------|-------------|--------------|
96+
| `NEXUS_USERNAME` | `CENTRAL_PORTAL_USERNAME` | Central Portal username/token | https://central.sonatype.com/ → Generate User Token |
97+
| `NEXUS_PASSWORD` | `CENTRAL_PORTAL_PASSWORD` | Central Portal password/token | https://central.sonatype.com/ → Generate User Token |
98+
| `GPG_PRIVATE_KEY` | `SIGNING_PGP_PRIVATE_KEY` | PGP private key for signing | Your PGP keyring |
99+
| `GPG_PASSPHRASE` | `SIGNING_PGP_PASSPHRASE` | PGP key passphrase | Your PGP key passphrase |
100+
101+
**Note**: When publishing manually (outside of GitHub Actions), you must export the environment variable names shown in the second column (e.g., `CENTRAL_PORTAL_USERNAME`, not `NEXUS_USERNAME`).
100102

101103
## Release Workflow
102104

@@ -121,7 +123,7 @@ This is the simplest approach - artifacts are automatically published to Maven C
121123
The workflow will:
122124

123125
1.**Validate Gradle wrapper** (security check)
124-
2.**Set up JDK 17** (required for building and nmcp plugin)
126+
2.**Set up JDK 21** (required for building and nmcp plugin)
125127
3.**Build all artifacts** (testng.jar, sources, javadoc)
126128
4.**Sign artifacts** with PGP key
127129
5.**Upload to Central Portal**
@@ -181,7 +183,7 @@ This approach uploads artifacts to Central Portal but waits for you to manually
181183
The workflow will:
182184

183185
1.**Validate Gradle wrapper** (security check)
184-
2.**Set up JDK 17** (required for building and nmcp plugin)
186+
2.**Set up JDK 21** (required for building and nmcp plugin)
185187
3.**Build all artifacts** (testng.jar, sources, javadoc)
186188
4.**Sign artifacts** with PGP key
187189
5.**Upload to Central Portal**
@@ -292,13 +294,15 @@ If you need to manually publish a snapshot:
292294
--stacktrace
293295
```
294296

295-
**Required environment variables**:
297+
**Required environment variables** (see the [Required Secrets](#required-secrets-already-configured) table):
296298

297299
```bash
298300
export CENTRAL_PORTAL_USERNAME="your-token-username"
299301
export CENTRAL_PORTAL_PASSWORD="your-token-password"
300302
```
301303

304+
**Note**: Use the environment variable names (`CENTRAL_PORTAL_*`), not the GitHub secret names (`NEXUS_*`).
305+
302306
---
303307

304308
## Post-Release Activities
@@ -409,9 +413,9 @@ If there are documentation changes:
409413

410414
**Problem**: The nmcp plugin requires Java 17 or higher.
411415

412-
**Solution**: The workflow already uses JDK 17. If you see this error, check:
416+
**Solution**: The workflow already uses JDK 21. If you see this error, check:
413417

414-
- The workflow file uses `java-version: 17`
418+
- The workflow file uses `java-version: 21`
415419
- The setup-java step completed successfully
416420

417421
### Workflow Fails: "Authentication failed"
@@ -618,6 +622,8 @@ Developer GitHub Actions Central Portal
618622

619623
### Common Commands
620624

625+
**Note**: All publishing commands require environment variables to be set. See [Required Secrets](#required-secrets-already-configured) for details.
626+
621627
```bash
622628
# Publish release (automatic)
623629
./gradlew publishAggregationToCentralPortal \
@@ -630,13 +636,21 @@ Developer GitHub Actions Central Portal
630636
-PcentralPortal.publishingType=USER_MANAGED
631637

632638
# Publish snapshot
633-
./gradlew publishAllPublicationsToCentralSnapshotsRepository \
639+
./gradlew publishAggregationToCentralPortalSnapshots \
634640
-Prelease=false
635641

636642
# Build without publishing
637643
./gradlew build -Prelease=true
638644
```
639645

646+
**Required environment variables for publishing**:
647+
```bash
648+
export CENTRAL_PORTAL_USERNAME="your-token-username"
649+
export CENTRAL_PORTAL_PASSWORD="your-token-password"
650+
export SIGNING_PGP_PRIVATE_KEY="your-pgp-private-key"
651+
export SIGNING_PGP_PASSPHRASE="your-pgp-passphrase"
652+
```
653+
640654
### Important URLs
641655

642656
| Purpose | URL |

testng-core/testng-core-build.gradle.kts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ dependencies {
4141
implementation(projects.testngRunnerApi)
4242
implementation("org.webjars:jquery:3.7.1")
4343
testImplementation(projects.testngAsserts)
44-
testImplementation("org.codehaus.groovy:groovy-all:3.0.13") {
44+
// Groovy 4.x is required to support Java 21 bytecode (class file major version 65)
45+
// Groovy 3.x doesn't support reading Java 21 bytecode
46+
testImplementation("org.apache.groovy:groovy-all:4.0.29") {
4547
exclude("org.testng", "testng")
4648
}
4749
testImplementation("org.apache-extras.beanshell:bsh:2.0b6")
@@ -59,9 +61,8 @@ tasks.compileTestGroovy {
5961
dependsOn(tasks.compileTestKotlin)
6062
classpath += files(tasks.compileTestKotlin)
6163
}
62-
tasks.compileTestKotlin {
63-
classpath = sourceSets.test.get().compileClasspath
64-
}
64+
// Note: In Kotlin 2.3.0+, the classpath property on KotlinCompile task has been removed.
65+
// The classpath is now automatically managed through source sets, so no manual configuration is needed.
6566

6667
tasks.test {
6768
maxParallelForks = Runtime.getRuntime().availableProcessors().div(2)

0 commit comments

Comments
 (0)