fix(java): keep Maven system-scope jars on the run classpath (#6070)

The IDE build's Maven extension left system-scope dependencies out of
the runtime classpath it records, and launches built by the IDE replay
that classpath, so a Spring Boot app whose POM points at lib/*.jar with
<systemPath> failed with NoClassDefFoundError. A systemPath names an
explicit file the JVM must load (IDEA imports the scope as Compile);
provided stays excluded. The rebuilt jar changes java_build_version, so
existing build models are prepared again.

Fixes #6023
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-11-26 13:00:14 +08:00
1 джерело e998e2ca8e
коміт fe7fa7d505
2 files changed
+6 -2

No files matched your search

+6 -2
Переглянути файл
@@ -303,7 +303,11 @@ public final class BuildModel extends AbstractMavenLifecycleParticipant {
json.append("}}");
}
/** The classpaths of the resolved graph, in Maven's order: compile, runtime, test scopes. */
/**
* The classpaths of the resolved graph, in Maven's order: compile, runtime, test scopes. A
* {@code system} jar is on the runtime classpath too: it is an explicit file the launched JVM
* must load (IDEA imports the scope as Compile), while {@code provided} is the container's.
*/
private static void classpaths(DependencyNode root, List<String> compile, List<String> runtime, List<String> test) {
List<DependencyNode> nodes = new ArrayList<>();
collect(root, nodes, new HashSet<>());
@@ -314,7 +318,7 @@ public final class BuildModel extends AbstractMavenLifecycleParticipant {
String scope = node.getDependency().getScope();
String path = file.getAbsolutePath();
if (!"test".equals(scope) && !"runtime".equals(scope)) compile.add(path);
if (!"test".equals(scope) && !"provided".equals(scope) && !"system".equals(scope)) runtime.add(path);
if (!"test".equals(scope) && !"provided".equals(scope)) runtime.add(path);
test.add(path);
}
}
Бінарний файл не відображається.