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

Not able to run validate due to ExtensionRegistry return null value #800

Closed
galan opened this issue Nov 2, 2023 · 4 comments
Closed

Not able to run validate due to ExtensionRegistry return null value #800

galan opened this issue Nov 2, 2023 · 4 comments
Labels

Comments

@galan
Copy link

galan commented Nov 2, 2023

Describe the bug
I integrated the formatter, but executing mvn formatter:validate returns this error:

[ERROR] Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.23.0:validate (default-cli) on project tester: Execution default-cli of goal net.revelc.code.formatter:formatter-maven-plugin:2.23.0:validate failed: Cannot invoke "org.eclipse.core.runtime.IExtensionRegistry.getExtensionPoint(String, String)" because the return value of "org.eclipse.core.runtime.Platform.getExtensionRegistry()" is null -> [Help 1]

Versions (OS, Maven, Java, and others, as appropriate):

  • Affected version(s) of this project: 2.23.0
  • Java version: 17.0.5, vendor: Eclipse Adoptium
  • Apache Maven 3.8.8
  • OS: Xubuntu / x86_64 Linux 6.2.0-36-generic

Integration in maven:

	<build>
		<plugins>
			<plugin>
				<groupId>net.revelc.code.formatter</groupId>
				<artifactId>formatter-maven-plugin</artifactId>
				<version>2.23.0</version>
				<configuration>
					<configFile>${project.basedir}/eclipse-style.xml</configFile>
					<overrideConfigCompilerVersion>true</overrideConfigCompilerVersion>
					<compilerSource>1.17</compilerSource>
					<compilerCompliance>1.17</compilerCompliance>
					<compilerTargetPlatform>1.17</compilerTargetPlatform>
				</configuration>
			</plugin>
		</plugins>
	</build>

To Reproduce
Steps to reproduce the behavior (or a link to an example repository that reproduces the problem):

  1. Performing mvn formatter:validate (mvn formatter:format creates the same error, only mvn formatter:help works)

Expected behavior
Working pluging and no exception

@galan galan added the bug label Nov 2, 2023
@ctubbsii
Copy link
Member

ctubbsii commented Nov 20, 2023

@galan There's no such Java version as 1.17. Change it to 17, and let us know if that works (will close in the meantime).

@ctubbsii ctubbsii closed this as not planned Won't fix, can't repro, duplicate, stale Nov 20, 2023
@galan
Copy link
Author

galan commented Nov 23, 2023

Thanks for the hint, but unfortunately, the same error persists. @ctubbsii

[ERROR] Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.23.0:validate (default-cli) on project tester: Execution default-cli of goal net.revelc.code.formatter:formatter-maven-plugin:2.23.0:validate failed: Cannot invoke "org.eclipse.core.runtime.IExtensionRegistry.getExtensionPoint(String, String)" because the return value of "org.eclipse.core.runtime.Platform.getExtensionRegistry()" is null -> [Help 1]

@ctubbsii
Copy link
Member

I could not reproduce the error, but I don't have your config file. I google'd for the error, and came across a similar issue, diffplug/spotless#1638 (comment), which pointed us back to our own issue #621 (comment)

So, I suspect your config file is not valid or is not compatible with the version of Eclipse JDT that this plugin is using. You can try importing your config file, and re-exporting it, from the corresponding Eclipse version for this plugin version.

@galan
Copy link
Author

galan commented Nov 30, 2023

Yes, regarding your version compatibility sheet, this maven plugin does not cover the current eclipse verions. My version:

Eclipse IDE for Java Developers (includes Incubating components)
Version: 2023-09 (4.29.0)
Build id: 20230907-1323
OS: Linux, v.6.2.0-37-generic, x86_64 / gtk 3.24.33, WebKit 2.42.2
Java vendor: Eclipse Adoptium
Java runtime version: 17.0.9+9
Java version: 17.0.9

However, I downloaded Eclipse 2023-03 (4.27.0) and did an export for the older version, but the result was the same error as above.

Then I tested the hint from #621 (comment) and it turned out, that removing the following line also helped removing the error.

<setting id="org.eclipse.jdt.core.javaFormatter" value="org.eclipse.jdt.core.defaultJavaFormatter"/>

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

2 participants