Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to build version 1.41.0 with Java 17 due to "Unknown OSGi execution environment: 'JavaSE-23'" #3326

Closed
sham1 opened this issue Nov 16, 2024 · 2 comments · Fixed by #3327
Assignees

Comments

@sham1
Copy link

sham1 commented Nov 16, 2024

So, I was trying to build a container with JDTLS in it using the following Dockerfile:

ARG VERSION=1.41.0

FROM docker.io/library/eclipse-temurin:17-alpine AS builder

ARG VERSION

ADD "https://github.com/eclipse-jdtls/eclipse.jdt.ls/archive/refs/tags/v$VERSION.tar.gz" /build.tar.gz

RUN tar -xzf /build.tar.gz && mv "eclipse.jdt.ls-$VERSION" /build

WORKDIR /build

RUN --mount=type=cache,id=maven-cache,target=/root/.m2 \
	./mvnw clean verify -DskipTests=true

FROM docker.io/library/eclipse-temurin:17-alpine

COPY --from=builder /build/org.eclipse.jdt.ls.product/target/repository /opt/jdtls

ENV PATH="/opt/jdtls/bin:$PATH"

The build starts out nicely, but once it hits the "JDT Language Server :: Tests" module, the build fails with the error

[ERROR] Unknown OSGi execution environment: 'JavaSE-23'

My question is whether this is expected, and that the project itself should be built with the JDK version in question, after which it'll work with Java 17 or 21, or whether this is a bug in the build system and the tests. Another possibility could be that it just requires Java 23 as a whole, since the build will succeed with the eclipse-temurin:23-alpine image.

@sham1 sham1 changed the title Failure to build 1.41.0 with Java 17 due to "Unknown OSGi execution environment: 'JavaSE-23'" Failure to build version 1.41.0 with Java 17 due to "Unknown OSGi execution environment: 'JavaSE-23'" Nov 16, 2024
@rgrunber
Copy link
Contributor

It's because of https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/3167/files#diff-020a82fa8f4c39ac779de9926bba9e2d8fc4d57106e29101532d110e70221274R8 . JDT-LS, when run with the javac compiler support bundle, requires Java 23 at runtime, but only Java 17 with ECJ (the default). However, it seems the test bundle depends on the javac bundle which I'm guessing forces Java 23.

@mickaelistria does your comment there about extraRequirement mean we could avoid having the tests depend on javac directly and move the requirement back to JavaSE-17 (for ECJ) ?

@mickaelistria
Copy link
Contributor

If the extraRequirements on org.eclipse.jdt.core.javac is isolated in a profile that is not enabled by default, then Java 23 shouldn't be influencing the build and Java 17 could still be used.
But I would personally recommend just using Java 23 in the Dockerfile, that wouldn't harm.

@rgrunber rgrunber self-assigned this Nov 19, 2024
@rgrunber rgrunber moved this to Pending review in Java Tooling Nov 19, 2024
@github-project-automation github-project-automation bot moved this from Pending review to Done in Java Tooling Nov 19, 2024
@rgrunber rgrunber added this to the End November 2024 milestone Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants