Skip to content

Commit 507486d

Browse files
dependabot[bot]GitHub CopilotCopilot
authored
Bump jvm from 2.0.0 to 2.3.21 in /test-project-kotlin (#337)
* Bump jvm from 2.0.0 to 2.3.21 in /test-project-kotlin Bumps [jvm](https://github.com/JetBrains/kotlin) from 2.0.0 to 2.3.21. - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](JetBrains/kotlin@v2.0.0...v2.3.21) --- updated-dependencies: - dependency-name: jvm dependency-version: 2.3.21 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Fix TestEngine compatibility with Kotlin 2.3.x In Kotlin 2.3.x, the Kotlin Gradle Plugin adds dependency constraints to the runtimeClasspath configuration and marks it as non-declarable (canBeDeclared=false). When TestEngine.copyRecursive() copies such a configuration, Gradle throws: GradleException: Dependency constraints can not be declared against the runtimeClasspath configuration. Fix by moving copyRecursive() inside the try block and catching GradleException (which is the parent of ResolveException, so both are handled). On failure the code falls back to using direct dependencies only, as before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: GitHub Copilot <copilot@github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c62bf25 commit 507486d

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/main/java/org/javamodularity/moduleplugin/TestEngine.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.javamodularity.moduleplugin;
22

3+
import org.gradle.api.GradleException;
34
import org.gradle.api.Project;
45
import org.gradle.api.artifacts.*;
56
import org.gradle.api.logging.Logger;
@@ -115,17 +116,17 @@ private static Stream<GroupArtifact> getModuleIdentifiers(Configuration origCfg,
115116
return getDirectDependencies(origCfg);
116117
}
117118

118-
Configuration cfg = origCfg.copyRecursive();
119-
cfg.setCanBeResolved(true);
120119
try {
120+
Configuration cfg = origCfg.copyRecursive();
121+
cfg.setCanBeResolved(true);
121122
cfg.resolve();
122123
Set<ResolvedDependency> flmDeps = cfg.getResolvedConfiguration().getFirstLevelModuleDependencies();
123124
return flmDeps.stream()
124125
.flatMap(dep -> Stream.concat(getAllDeps(dep).stream(),Stream.of(dep)))
125126
.filter(dep -> isDependencyPresent(dep, files))
126127
.map(dep -> GroupArtifact.fromModuleIdentifier(dep.getModule().getId().getModule()));
127-
} catch (ResolveException e) {
128-
LOGGER.debug("Cannot resolve transitive dependencies of configuration " + cfg.getName(), e);
128+
} catch (GradleException e) {
129+
LOGGER.debug("Cannot resolve transitive dependencies of configuration " + origCfg.getName(), e);
129130
return getDirectDependencies(origCfg);
130131
}
131132
}

test-project-kotlin/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
22

33
plugins {
4-
kotlin("jvm") version "2.0.0" apply false
4+
kotlin("jvm") version "2.3.21" apply false
55
id("org.javamodularity.moduleplugin") version "2.0.0" apply false
66
}
77

0 commit comments

Comments
 (0)