Skip to content

Commit afecc4b

Browse files
Copilotpeterkir
andcommitted
feat(osgi): add Eclipse JDT Java 21 compiler prefs to all projects
Create .settings/org.eclipse.jdt.core.prefs in every Eclipse project (root _root, cnf, api, app, core, test.integration) with: compliance=21, source=21, target=21, release=enabled Eclipse reads these files automatically when projects are imported (File > Import > Existing Projects) — no manual step required. Also update osgi/README.md with a new "Eclipse Java compiler settings" section that documents the four auto-import options ranked by how automatic they are (project .settings, BNDTools build.bnd, Oomph, .epf). Agent-Logs-Url: https://github.com/klibio/bootstrap/sessions/8752883e-84df-495e-bc34-414baf4ccee8 Co-authored-by: peterkir <250545+peterkir@users.noreply.github.com>
1 parent 3381d6d commit afecc4b

7 files changed

Lines changed: 63 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
3+
org.eclipse.jdt.core.compiler.compliance=21
4+
org.eclipse.jdt.core.compiler.release=enabled
5+
org.eclipse.jdt.core.compiler.source=21

osgi/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,39 @@ Eclipse will resolve the workspace dependencies automatically via the
146146
147147
---
148148

149+
## Eclipse Java compiler settings
150+
151+
Every Eclipse project in this workspace ships a
152+
`.settings/org.eclipse.jdt.core.prefs` file that sets the JDT compiler to
153+
**Java 21**:
154+
155+
```properties
156+
eclipse.preferences.version=1
157+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
158+
org.eclipse.jdt.core.compiler.compliance=21
159+
org.eclipse.jdt.core.compiler.release=enabled
160+
org.eclipse.jdt.core.compiler.source=21
161+
```
162+
163+
These values mirror the `javac.source`/`javac.target` already declared in
164+
`cnf/build.bnd`, so both the Gradle build and the Eclipse IDE use the same
165+
compiler level.
166+
167+
### How the settings are applied automatically
168+
169+
Eclipse reads `.settings/org.eclipse.jdt.core.prefs` the moment a project is
170+
imported — **no manual action is required**. The table below lists all
171+
available options ranked by how automatic they are:
172+
173+
| # | Mechanism | Automatic? | When it applies |
174+
|---|-----------|-----------|-----------------|
175+
| **1** | **Project-level `.settings/org.eclipse.jdt.core.prefs`** (used here) |**Yes** | As soon as *File → Import → Existing Projects* completes — Eclipse JDT reads the file for every imported project. |
176+
| **2** | **BNDTools `build.bnd` (`javac.source` / `javac.target`)** |**Yes** | BNDTools reads the workspace `build.bnd` and configures each bnd project's JDT compiler settings automatically. This workspace already defines `javac.source=21` and `javac.target=21` in `cnf/build.bnd`. |
177+
| **3** | **Oomph setup model (`.setup` file)** |**Yes** | An Oomph project model can run during Eclipse startup to import preferences, install plug-ins, and set workspace options. Most useful for distributing a fully-automated team workspace via the Eclipse Installer. Higher setup cost. |
178+
| **4** | **Eclipse Preferences File (`.epf`) — manual import** |**No** | An `.epf` file holds workspace-level preferences but must be imported by the developer via *File → Import → General → Preferences*. Useful as a fallback or for workspace-scope settings (e.g. formatter, clean-up) that cannot live in a project folder. |
179+
180+
---
181+
149182
## Key version numbers
150183

151184
| Component | Version |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
3+
org.eclipse.jdt.core.compiler.compliance=21
4+
org.eclipse.jdt.core.compiler.release=enabled
5+
org.eclipse.jdt.core.compiler.source=21
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
3+
org.eclipse.jdt.core.compiler.compliance=21
4+
org.eclipse.jdt.core.compiler.release=enabled
5+
org.eclipse.jdt.core.compiler.source=21
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
3+
org.eclipse.jdt.core.compiler.compliance=21
4+
org.eclipse.jdt.core.compiler.release=enabled
5+
org.eclipse.jdt.core.compiler.source=21
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
3+
org.eclipse.jdt.core.compiler.compliance=21
4+
org.eclipse.jdt.core.compiler.release=enabled
5+
org.eclipse.jdt.core.compiler.source=21
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
3+
org.eclipse.jdt.core.compiler.compliance=21
4+
org.eclipse.jdt.core.compiler.release=enabled
5+
org.eclipse.jdt.core.compiler.source=21

0 commit comments

Comments
 (0)