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

building with openjdk21 #3364

Closed
quadraplat opened this issue Jan 19, 2025 · 10 comments
Closed

building with openjdk21 #3364

quadraplat opened this issue Jan 19, 2025 · 10 comments
Labels

Comments

@quadraplat
Copy link

quadraplat commented Jan 19, 2025

Hello, i am trying to package this for chimera linux, which only packages lts java releases (meaning 21 is the most up to data java) and I cannot seem to compile it, as I am met with the following error.

[ERROR] org.eclipse.jdt.core.javac 1.0.0.z20250110-0554 requires Execution Environment that matches (&(osgi.ee=JavaSE)(version=23)) but the current resolution context uses [a.jre.javase 21.0.0]
[ERROR] Cannot resolve target definition:
[ERROR]   Software being installed: org.eclipse.jdt.core.javac 1.0.0.z20250110-0554
[ERROR]   Missing requirement: org.eclipse.jdt.core.javac 1.0.0.z20250110-0554 requires 'osgi.ee; (&(osgi.ee=JavaSE)(version=23))' but it could not be found
[ERROR] 

Is it expected that this does not build with java21? I saw some issues talking about java21, but I am unsure if they are related to this?

@rgrunber
Copy link
Contributor

rgrunber commented Jan 20, 2025

What does your call to mvn look like ? Also are you able to paste the full build logs somewhere .. or at least the Maven plugin that fails ? It's true that org.eclipse.jdt.jcore.javac does require Java 23 at runtime, but I'm able to build without any Java 23 JDK on the system.

As far as I can tell the osgi.ee=JavaSE version=23 requirement is provided by a special bundle called a.jre.javase located within the target platform of the project :

<repository location="https://download.eclipse.org/eclipse/updates/4.35-I-builds/"/>

IU: a.jre.javase 23.0.0
* osgi.ee; version:OSGiVersion=1.0.0; osgi.ee:String=OSGi/Minimum
* osgi.ee; version:OSGiVersion=1.1.0; osgi.ee:String=OSGi/Minimum
* osgi.ee; version:OSGiVersion=1.2.0; osgi.ee:String=OSGi/Minimum
* osgi.ee; version:OSGiVersion=1.0.0; osgi.ee:String=JRE
* osgi.ee; version:OSGiVersion=1.1.0; osgi.ee:String=JRE
* osgi.ee; version:OSGiVersion=1.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=1.1.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=1.2.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=1.3.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=1.4.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=1.5.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=1.6.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=1.7.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=1.8.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=9.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=10.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=11.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=12.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=13.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=14.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=15.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=16.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=17.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=18.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=19.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=20.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=21.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=22.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=23.0.0; osgi.ee:String=JavaSE
* osgi.ee; version:OSGiVersion=1.8.0; osgi.ee:String=JavaSE/compact1
* osgi.ee; version:OSGiVersion=23.0.0; osgi.ee:String=JavaSE/compact1
* osgi.ee; version:OSGiVersion=1.8.0; osgi.ee:String=JavaSE/compact2
* osgi.ee; version:OSGiVersion=23.0.0; osgi.ee:String=JavaSE/compact2
* osgi.ee; version:OSGiVersion=1.8.0; osgi.ee:String=JavaSE/compact3
* osgi.ee; version:OSGiVersion=23.0.0; osgi.ee:String=JavaSE/compact3

@quadraplat are there any modifications you're carrying in the JDT-LS repo ?
@snjeza have you seen this happen ?

@snjeza
Copy link
Contributor

snjeza commented Jan 20, 2025

@snjeza have you seen this happen ?

No, I haven't seen that with JDK 21, Java LS master

@rgrunber You can reproduce the issue in the following way:

  • remove JDK >=23 from ~/.m2/toolchains.xml
  • start the build as
$ ./mvnw clean verify -B -U -fae -Pjavac -DskipTests -Declipse.jdt.ls.skipGradleChecksums=true

@snjeza
Copy link
Contributor

snjeza commented Jan 20, 2025

@quadraplat Could you try to create ~/.m2/toolchains.xml? See Guide to Using Toolchains.

@rgrunber
Copy link
Contributor

Ah right, but that really isn't a valid case. You absolutely need a JDK 23 on your system if you're going to have -Pjavac. I meant, could it happen without that flag.

@snjeza
Copy link
Contributor

snjeza commented Jan 20, 2025

... I meant, could it happen without that flag.

No, it doesn't happen without -Pjavac

@quadraplat
Copy link
Author

quadraplat commented Jan 20, 2025

are there any modifications you're carrying in the JDT-LS repo ?

I am not patching jdtls in any way, but I tried building normally from source and it worked. The issue is likely that chimera has some special requirements, like not making network calls during build phase, so I have to fetch all dependencies beforehand. I did this with (which worked with v1.40.0)
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:go-offline -Dmaven.repo.local=repository
followed by
mvn verify --fail-never -DskipTests -Dmaven.repo.local=repository
and then finally to actually build the package
mvn -o -DskipTests -Dmaven.repo.local=repository package

However, it fails already in the first command invocation:
gist

@rgrunber
Copy link
Contributor

rgrunber commented Jan 20, 2025

I'm seeing the same thing. Maybe this is some kind of limitation with maven-dependency-plugin and Tycho (the Maven plugin that handles integration/building Eclipse OSGi projects). I understand the need to have to build offline but if that's the case, why not run the full build as usual with -Dmaven.repo.local=repository and then just run it again by also adding --offline as the dependencies would have all been fetched as part of the first run.

I'm not sure specifically why it stopped working after 1.40.0. It's true that the javac support was after that release (and that's clearly where it's breaking) but not sure why it breaks :\

@quadraplat
Copy link
Author

When just trying to run mvn -DskipTests -Dmaven.repo.local=repository compile, I am faced with the following error message:
gist

Note this is 1.44.0 now

@rgrunber
Copy link
Contributor

Failed to execute goal org.eclipse.tycho:tycho-p2-director-plugin:4.0.10:materialize-products (create-distributions)

I'm not sure how materialize-products would have run based on the above command. It needs at least the package phase to run according to https://tycho.eclipseprojects.io/doc/4.0.10/tycho-p2-director-plugin/materialize-products-mojo.html . However, compile is well before package and would not have triggered that goal. Maybe you're running in an environment where something else is overriding the behaviour ?

@quadraplat
Copy link
Author

hah, look like there was something bad in my local repository cache. clearing the entire cache and adding --fail-never to the first command lets the jdtls build successfully.
this can probably be closed?

@snjeza snjeza closed this as completed Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants