Skip to content

Commit 086b94f

Browse files
authored
[Build] Cache spotless p2 dependencies when baking ci image (#118523) (#118591)
The eclipse formatter used by spotless is resolved at runtime and not declared as gradle dependency. Therefore we need to run the spotless task to ensure we have the dependencies resolved as part of our ci image baking. This should avoid issues with connecting to p2 repos we have experienced lately in our ci environment * Revert "[Build] Declare mirror for eclipse p2 repository (#117732)" This reverts commit c35777a.
1 parent 96625ea commit 086b94f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/precommit/FormattingPrecommitPlugin.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
import org.gradle.api.Project;
1818

1919
import java.io.File;
20-
import java.util.Arrays;
21-
import java.util.Map;
2220

2321
/**
2422
* This plugin configures formatting for Java source using Spotless
@@ -66,8 +64,7 @@ public void apply(Project project) {
6664
java.importOrderFile(new File(elasticsearchWorkspace, importOrderPath));
6765

6866
// Most formatting is done through the Eclipse formatter
69-
java.eclipse().withP2Mirrors(Map.of("https://download.eclipse.org/", "https://mirror.umd.edu/eclipse/"))
70-
.configFile(new File(elasticsearchWorkspace, formatterConfigPath));
67+
java.eclipse().configFile(new File(elasticsearchWorkspace, formatterConfigPath));
7168

7269
// Ensure blank lines are actually empty. Since formatters are applied in
7370
// order, apply this one last, otherwise non-empty blank lines can creep

build.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,10 @@ allprojects {
294294
if (project.path.contains(":distribution:docker")) {
295295
enabled = false
296296
}
297-
297+
if (project.path.contains(":libs:cli")) {
298+
// ensure we resolve p2 dependencies for the spotless eclipse formatter
299+
dependsOn "spotlessJavaCheck"
300+
}
298301
}
299302

300303
plugins.withId('lifecycle-base') {

0 commit comments

Comments
 (0)