дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 01:31:41 +02:00
fix(java): apply the Eclipse plugin to the project in the Gradle classpath init script (#5677)
Inside the Gradle classpath init script's closures a bare `apply plugin: 'eclipse'` resolves to the init script's own apply. On Gradle 7 the Eclipse plugin then can't get its project services (no IdeArtifactRegistry), applying java fails, and jdtls's Gradle import fails for every Gradle 7 project, leaving all Java files red. The script now calls project.apply; a test keeps bare apply calls out of it. Fixes #5669
Цей коміт міститься в:
1 джерело
7532ff30fd
коміт
af3e174702
2 files changed
+13
-1
No files matched your search
@@ -2796,6 +2796,16 @@ mod maven_linkage_tests {
|
||||
assert!(nowhere.settings.is_none(), "no usable directory: the import runs without it");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gradle_classpath_script_applies_plugins_to_the_project() {
|
||||
// Inside the script's closures a bare `apply` is the init script's own: on Gradle 7 the
|
||||
// Eclipse plugin then fails to start and the whole import fails.
|
||||
let script = include_str!("gradle-classpath.init.gradle");
|
||||
let bare: Vec<&str> = script.lines().filter(|line| line.trim_start().starts_with("apply ")).collect();
|
||||
assert!(bare.is_empty(), "{bare:?}");
|
||||
assert!(script.contains("project.apply plugin: 'eclipse'"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gradle_import_of_a_gradle_build_runs_on_the_project_jdk_like_the_ides_builds() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
// compile classpath names, so Java code sees the classes it compiles against.
|
||||
allprojects {
|
||||
plugins.withId('java') {
|
||||
apply plugin: 'eclipse'
|
||||
// `project.`: a bare `apply` in this closure is the init script's own (Gradle 7 fails to create the
|
||||
// plugin then: no IdeArtifactRegistry service).
|
||||
project.apply plugin: 'eclipse'
|
||||
eclipse.classpath.file.whenMerged { classpath ->
|
||||
def projectOf = { dep ->
|
||||
def path
|
||||
|
||||
Reference in new issue
Заблокувати користувача