Skip to content

Upgrade to Eclipse 2022-09 #342

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

Closed
hjoeren opened this issue Sep 15, 2022 · 4 comments
Closed

Upgrade to Eclipse 2022-09 #342

hjoeren opened this issue Sep 15, 2022 · 4 comments

Comments

@hjoeren
Copy link

hjoeren commented Sep 15, 2022

During "Updating Maven Project" in Eclipse 2022-09, a NoSuchMethodException occurs. Here is the output of the Eclipse Error Log:

java.lang.NoSuchMethodError: 'org.apache.maven.project.MavenProject org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest.getMavenProject()'
	at io.spring.javaformat.eclipse.m2e.MavenProjectSettingsConfigurator.getSearchFolders(MavenProjectSettingsConfigurator.java:52)
	at io.spring.javaformat.eclipse.m2e.MavenProjectSettingsConfigurator.lambda$0(MavenProjectSettingsConfigurator.java:44)
	at io.spring.javaformat.eclipse.Executor.run(Executor.java:48)
	at io.spring.javaformat.eclipse.m2e.MavenProjectSettingsConfigurator.configure(MavenProjectSettingsConfigurator.java:43)
	at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:125)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$6(ProjectConfigurationManager.java:475)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:350)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:262)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:469)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$4(ProjectConfigurationManager.java:413)
	at java.base/java.util.Collection.removeIf(Collection.java:576)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:407)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$3(ProjectConfigurationManager.java:339)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:350)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:262)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:205)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1093)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:338)
	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)

(If helpful) here is the session data:

eclipse.buildId=4.25.0.I20220831-1800
java.version=17.0.2
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -data file:/home/hjoeren/git/ -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product

After the update from Eclipse 2022-06 to 2022-09, org.eclipse.m2e:m2e-core:2.0.3 is in use, and it looks like several classes were replaced by records. ProjectConfigurationRequest is one of those replaced classes:

https://github.com/eclipse-m2e/m2e-core/blob/2.0.3/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/ProjectConfigurationRequest.java

Here is the commit with the replacement of classes with records: eclipse-m2e/m2e-core@c3ade99

@hjoeren hjoeren changed the title NoSuchMethodException during updating project in Eclipse 2022-09 NoSuchMethodException during updating maven project in Eclipse 2022-09 Sep 15, 2022
@wilkinsona
Copy link
Contributor

Thanks for the report. Adapting to the breaking API changes is further complicated by the fact that m2e-core requires Java 17.

@wilkinsona wilkinsona changed the title NoSuchMethodException during updating maven project in Eclipse 2022-09 Update to Eclipse 2022-09 Sep 16, 2022
@wilkinsona
Copy link
Contributor

https://github.com/wilkinsona/spring-javaformat/tree/m2e-2.0. I haven't yet checked if JDT has moved to Java 17 as well.

@wilkinsona wilkinsona changed the title Update to Eclipse 2022-09 Upgrade to Eclipse 2022-09 Sep 16, 2022
@hjoeren
Copy link
Author

hjoeren commented Sep 26, 2022

Just tried to build the m2e-2.0-branch of the fork: Out of the box I was not able to package the whole project but after disabling some modules and excluding some plugins I got it working.

(I used the sdkman environment)

After installing the plugin in 2022-09 with the generated site-archive, at first glance everything was alright ("Update Maven Project" was working, Copyright header was generated, auto-formatting worked, ...)

Reasons why I had to disable some modules/exclude some plugins:

  • disabling io.spring.javaformat.eclipse.tests module: Missing requirement: io.spring.javaformat.eclipse.tests 0.0.35.qualifier requires 'osgi.bundle; org.junit.jupiter.api 0.0.0' but it could not be found
  • exclude proguard plugin: Can't read [java.scripting.jmod]
  • exclude javadoc plugin: error: No public or protected classes found to document.
  • disabling gralde module : java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x4bc47d2c) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x4bc47d2c
  • disabling intellij module: (i just wand to package the eclipse plugin ...)

Diffs I made to package the project:

diff --git a/pom.xml b/pom.xml
index 8e1477c..0bed82b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -377,7 +377,7 @@
 					<target>${java.version}</target>
 				</configuration>
 			</plugin>
-			<plugin>
+			<!--<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-javadoc-plugin</artifactId>
 				<executions>
@@ -388,7 +388,7 @@
 						</goals>
 					</execution>
 				</executions>
-			</plugin>
+			</plugin>-->
 			<plugin>
 				<groupId>org.codehaus.mojo</groupId>
 				<artifactId>flatten-maven-plugin</artifactId>
@@ -598,9 +598,9 @@
 	<modules>
 		<module>spring-javaformat</module>
 		<module>spring-javaformat-maven</module>
-		<module>spring-javaformat-gradle</module>
+		<!--<module>spring-javaformat-gradle</module>-->
 		<module>spring-javaformat-eclipse</module>
-		<module>spring-javaformat-intellij-idea</module>
+		<!--<module>spring-javaformat-intellij-idea</module>-->
 	</modules>
 	<profiles>
 		<profile>
diff --git a/spring-javaformat-eclipse/pom.xml b/spring-javaformat-eclipse/pom.xml
index 4300f9d..5f1bd68 100644
--- a/spring-javaformat-eclipse/pom.xml
+++ b/spring-javaformat-eclipse/pom.xml
@@ -88,7 +88,7 @@
 	</build>
 	<modules>
 		<module>io.spring.javaformat.eclipse</module>
-		<module>io.spring.javaformat.eclipse.tests</module>
+		<!--<module>io.spring.javaformat.eclipse.tests</module>-->
 		<module>io.spring.javaformat.eclipse.feature</module>
 		<module>io.spring.javaformat.eclipse.site</module>
 	</modules>
diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk11/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk11/pom.xml
index eb0b837..43fccad 100644
--- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk11/pom.xml
+++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk11/pom.xml
@@ -151,7 +151,7 @@
 					</execution>
 				</executions>
 			</plugin>
-			<plugin>
+			<!--<plugin>
 				<groupId>com.github.wvengen</groupId>
 				<artifactId>proguard-maven-plugin</artifactId>
 				<executions>
@@ -183,7 +183,7 @@
 						</configuration>
 					</execution>
 				</executions>
-			</plugin>
+			</plugin>-->
 		</plugins>
 	</build>
 	<dependencies>
diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml
index 8957826..7fa6999 100644
--- a/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml
+++ b/spring-javaformat/spring-javaformat-formatter-eclipse-jdk8/pom.xml
@@ -151,7 +151,7 @@
 					</execution>
 				</executions>
 			</plugin>
-			<plugin>
+			<!--<plugin>
 				<groupId>com.github.wvengen</groupId>
 				<artifactId>proguard-maven-plugin</artifactId>
 				<executions>
@@ -183,7 +183,7 @@
 						</configuration>
 					</execution>
 				</executions>
-			</plugin>
+			</plugin>-->
 		</plugins>
 	</build>
 	<dependencies>
diff --git a/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml b/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml
index c537bd4..1b8d8c0 100644
--- a/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml
+++ b/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/pom.xml
@@ -23,7 +23,7 @@
 	</dependencies>
 	<build>
 		<plugins>
-			<plugin>
+			<!--<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-jar-plugin</artifactId>
 				<executions>
@@ -38,7 +38,7 @@
 						</configuration>
 					</execution>
 				</executions>
-			</plugin>
+			</plugin>-->
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-source-plugin</artifactId>

@philwebb
Copy link
Contributor

philwebb commented Feb 6, 2023

Superseded by #352

@philwebb philwebb closed this as not planned Won't fix, can't repro, duplicate, stale Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants