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

Unable to update Maven configuration: Version 8 of project facet java does not exist. #1414

Closed
garretwilson opened this issue Jun 6, 2023 · 22 comments · Fixed by #1416
Closed
Assignees

Comments

@garretwilson
Copy link

garretwilson commented Jun 6, 2023

I upgraded to Eclipse EE 2023-06 RC1 (4.28.0 RC1) on Windows 10 and things started breaking.

In my long-running https://github.com/globalmentor/globalmentor-root project I have a pom.xml for Java 8 with the following line:

<maven.compiler.release>8</maven.compiler.release> <!-- JDK 9+ required to build -->

This is a Java compiler 9+ option (why it's needed is a long story), but there shouldn't be any problem with that. I'll just use a JDK version 9+ when building. And in fact in Eclipse I have the following JRE registered:

openjdk 17.0.4 2022-07-19
OpenJDK Runtime Environment Temurin-17.0.4+8 (build 17.0.4+8)
OpenJDK 64-Bit Server VM Temurin-17.0.4+8 (build 17.0.4+8, mixed mode, sharing)

I have another project https://github.com/globalmentor/globalmentor-base which uses globalmentor-root as its parent. In Eclipse EE 2023-06 if I try to refresh the project using Alt+F5, it tells me:

Unable to update Maven configuration
Could not update project globalmentor-management configuration
Version 8 of project facet java does not exist.
Could not update project globalmentor-core configuration
Version 8 of project facet java does not exist.

What does that mean? It has something to do with <maven.compiler.release>8</maven.compiler.release> in the globalmentor-root project, because if I change it to <maven.compiler.release>11/maven.compiler.release>, then suddenly I can refresh globalmentor-base.

But I want to release those two libraries for Java 8, not Java 11. It shouldn't matter that a JDK 9+ is required to build it.

Are you suddenly using the <maven.compiler.release>8/maven.compiler.release> to restrict the JDK used to build the project? The maven.compiler.release flag is to determine the target API, not to restrict the JDK being used to build the project. See JEP 247: Compile for Older Platform Versions.

Note that I have both globalmentor-root and globalmentor-base in my workspace, both set to -SNAPSHOT versions (minor upgrades).

This was working on Eclipse 2023-3 and for years earlier. If I can't find a way around this I'm going to have to roll back.

Here's a stack trace. Interestingly it mentions globalmentor-core and globalmentor-management, which are subprojects of globalmentor-base:

!ENTRY org.eclipse.m2e.core.ui 4 -1 2023-06-06 10:39:34.546
!MESSAGE Unable to update Maven configuration
!SUBENTRY 1 org.eclipse.m2e.core 4 0 2023-06-06 10:39:34.546
!MESSAGE Could not update project globalmentor-management configuration
!STACK 0
java.lang.IllegalArgumentException: Version 8 of project facet java does not exist.
	at org.eclipse.wst.common.project.facet.core.util.internal.Versionable.getVersion(Versionable.java:80)
	at org.eclipse.wst.common.project.facet.core.internal.ProjectFacet.getVersion(ProjectFacet.java:1)
	at org.eclipse.m2e.wtp.WTPProjectsUtil.installJavaFacet(WTPProjectsUtil.java:482)
	at org.eclipse.m2e.wtp.UtilityProjectConfigurator.configure(UtilityProjectConfigurator.java:65)
	at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:123)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$6(ProjectConfigurationManager.java:504)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:394)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:275)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:498)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$4(ProjectConfigurationManager.java:426)
	at java.base/java.util.Collection.removeIf(Collection.java:576)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:414)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$3(ProjectConfigurationManager.java:340)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:394)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:275)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:214)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1097)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:339)
	at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:80)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
!SUBENTRY 1 org.eclipse.m2e.core 4 0 2023-06-06 10:39:34.546
!MESSAGE Could not update project globalmentor-core configuration
!STACK 0
java.lang.IllegalArgumentException: Version 8 of project facet java does not exist.
	at org.eclipse.wst.common.project.facet.core.util.internal.Versionable.getVersion(Versionable.java:80)
	at org.eclipse.wst.common.project.facet.core.internal.ProjectFacet.getVersion(ProjectFacet.java:1)
	at org.eclipse.m2e.wtp.WTPProjectsUtil.installJavaFacet(WTPProjectsUtil.java:482)
	at org.eclipse.m2e.wtp.UtilityProjectConfigurator.configure(UtilityProjectConfigurator.java:65)
	at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:123)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$6(ProjectConfigurationManager.java:504)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:394)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:275)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:498)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$4(ProjectConfigurationManager.java:426)
	at java.base/java.util.Collection.removeIf(Collection.java:576)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:414)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$3(ProjectConfigurationManager.java:340)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:394)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:275)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:214)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1097)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:339)
	at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:80)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
@garretwilson
Copy link
Author

garretwilson commented Jun 6, 2023

Currently my workaround is:

  1. Go to globalmentor-root and set <maven.compiler.release>11/maven.compiler.release>.
  2. Go to globalmentor-base and use Alt+F5 to refresh the Maven project.
  3. Go back to globalmentor-root and set <maven.compiler.release>8/maven.compiler.release> as it was before.

Apparently this is sneaky enough that the new Eclipse doesn't notice and doesn't complain. I'll cross my fingers to see if it continues to work.

Unfortunately this means I'll need need to go through those workaround steps again if I ever need to refresh the globalmentor-base Maven project in Eclipse again.

@laeubi
Copy link
Member

laeubi commented Jun 7, 2023

@garretwilson I think its not m2e directly but wst complaining because it want 1.8 instead of 8 as the release value

@garretwilson
Copy link
Author

I think its not m2e directly but wst complaining because it want 1.8 instead of 8 as the release value

The correct value for <maven.compiler.release> is 8. See Setting the --release of the Java Compiler.

Are you saying I need to file a bug with WST?

@garretwilson
Copy link
Author

I can't find where to file bugs for WST.

We need to advance this quickly. This breaks fundamental Java versioning, and Eclipse 2023-06 is already at RC.

@akurtakov
Copy link
Contributor

https://bugs.eclipse.org/bugs/enter_bug.cgi?classification=WebTools is as much as I can help you

@garretwilson
Copy link
Author

I filed it at eclipse-m2e/m2e-wtp#26 ; is that what you were referring to? Or is there another WTP-related issue tracker still stuck on Bugzilla?

@garretwilson
Copy link
Author

I filed it at https://bugs.eclipse.org/bugs/show_bug.cgi?id=582041 as well.

@laeubi
Copy link
Member

laeubi commented Jun 7, 2023

I think its not m2e directly but wst complaining because it want 1.8 instead of 8 as the release value

The correct value for <maven.compiler.release> is 8. See Setting the --release of the Java Compiler.

Are you saying I need to file a bug with WST?

I can only tell you that from the error message something in org.eclipse.wst.common.project.facet.core.util.internal.Versionable.getVersion(Versionable.java:80) does not like the value 8 while it seem to accept 11 ... so I assumed it might expect the old version scheme for versions < 9 ...

On the other hand, maybe org.eclipse.m2e.wtp.WTPProjectsUtil.installJavaFacet could/should transform the value from the compiler release (8) to something that is understood by WST (1.8)..

Nerveless all this has nothing to do with Eclipse 2023-06 release in general as, just if there is a bugfix this can be installed after a release at any time. If m2e is critical to your business I can only recommend to follow the m2e snapshots from time to time so we can discover such things faster (and before any release).

@mickaelistria
Copy link
Contributor

On the other hand, maybe org.eclipse.m2e.wtp.WTPProjectsUtil.installJavaFacet could/should transform the value from the compiler release (8) to something that is understood by WST (1.8)..

Yes, m2e-wtp is IMO the right component to blame; it's its responsibility to turn Maven info into JDT info.

@mickaelistria
Copy link
Contributor

Closing here in favor of eclipse-m2e/m2e-wtp#26

@fbricon
Copy link
Contributor

fbricon commented Jun 7, 2023

Its a regression caused by #1327. Basically org.eclipse.jdt.core.compiler.compliance is now set to 8, instead of 1.8. This is wrong. I need to fix it.

@garretwilson
Copy link
Author

Any chance this will make it into the Eclipse EE 2022-06 final release? 🤞 Since my workspace is full of projects that are children of globalmentor-root, this keeps popping up all over the place. 😢

@mickaelistria
Copy link
Contributor

Any chance this will make it into the Eclipse EE 2022-06 final release? crossed_fingers

It seems very unlikely, however, you may just try to install m2e snapshots as soon as the fix is merged. Snapshots are usually of good quality and very rarely show blocking annoyance, and when it happens it's still possible to revert to a previous build and the issue is often fixed promptly. There is basically less annoyance in using snapshots than in using release and noticing it has some blocking issue and wait for a next release ;)

@garretwilson
Copy link
Author

The fix to this fundamental, breaking bug wasn't included in Eclipse EE 2023-09 M1 😮 ?!

Or am I doing something wrong?

@HannesWell
Copy link
Contributor

The fix to this fundamental, breaking bug wasn't included in Eclipse EE 2023-09 M1 😮 ?!

Or am I doing something wrong?

We didn't updated our contribution to SimRel yet (only releases are contributed), but we will in time for the final 23-09 Release.

In the meantime you can use the snapshots found at:
https://download.eclipse.org/technology/m2e/snapshots/2.4.0/

@garretwilson
Copy link
Author

There was a time (about 10–15 years ago) when such a fundamental breakage that is so low-level and far-reaching would result in a hotfix release.

If we're all supposed to move to the snapshot versions to keep fundamental things from breaking, what's the point of having separate release and snapshot paths?

@garretwilson
Copy link
Author

If we're all supposed to move to the snapshot versions to keep fundamental things from breaking, what's the point of having separate release and snapshot paths?

That was a rhetorical question. You don't need to answer. I'm not trying to start an argument; it's just frustrating to waste another morning with this and the new bugs from Eclipse EE 2023-09 M1 after I upgraded thinking it would fix this bug.

@laeubi
Copy link
Member

laeubi commented Aug 2, 2023

Well there was a time (10-15 years ago) whre big companies payed people for developing Eclipse code what could result in much more efforts put into things like extra releases.

Today its all mostly volunteer work but user demands are still high without much eager to being involved ... so basically no one of the people that volunteer to work seem to be too much affected that they care enough doing a new release for some small group of users if the can simply use the snapshots in the meanwhile...

And testing snapshots to verify fixes BEFORE the release are actually the most fundamental work reporter can/should do, so there is no need to complain that now this works but you found another issue.

@laeubi
Copy link
Member

laeubi commented Aug 2, 2023

N.B. this bug has not made it into the release if either:

  1. There was a testcase covering Java 8
  2. Users still using Java 8 would have tested the snapshot build prior to release

So even if this is annoying for you it seem no one (including you) was annoyed enough to either do (1) or (2) before (or after the fix), that's why I have introduced the rule at Tycho that there is no regression without a failing test, it is just impossible for small group of people to test every of the possible use-cases with each change, so automated tests are the only solution here.

@garretwilson
Copy link
Author

Snapshots are usually of good quality and very rarely show blocking annoyance, and when it happens it's still possible to revert to a previous build …

@mickaelistria it turns out the w2e snapshot currently does introduce a blocking bug: issue #1501. So currently I'm blocked if I revert to Eclipse EE 2023-06 wtp 2.3.0.20230523-2033 because of #1414; and blocked if I upgrade to the snapshot wtp 2.4.100.20230802-0719 because of #1501.

… and the issue is often fixed promptly.

That's wonderful news!! 🎉 I look forward to #1501 being fixed soon as you indicate, so that I can continue work on my projects.

Have a great weekend.

@rlogiacco
Copy link

I was hit by this problem after upgrading my STS distro... Hoping this finds it's way toward the release soon

@HannesWell
Copy link
Contributor

I was hit by this problem after upgrading my STS distro... Hoping this finds it's way toward the release soon

m2e 2.4.0 which includes the fix was released two days ago: https://github.com/eclipse-m2e/m2e-core/releases/tag/2.4.0 and you can update your Eclipse installation now.
It will be included in Eclipse 2023-09 released in about two weeks.
But I have no clue when Spring will include it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants