After one of the last plugin updates, opening or building a Maven project that uses the git-code-format-maven-plugin causes the following exception for each child module:
Failed to execute mojo com.cosium.code:git-code-format-maven-plugin:3.4:install-hooks {execution: install-formatter-hook} (com.cosium.code:git-code-format-maven-plugin:3.4:install-hooks:install-formatter-hook:initialize)
org.eclipse.core.runtime.CoreException: Failed to execute mojo com.cosium.code:git-code-format-maven-plugin:3.4:install-hooks {execution: install-formatter-hook}
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeMojo(MavenExecutionContext.java:340)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.lambda$0(MavenExecutionContext.java:291)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:371)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:275)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:290)
at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:57)
at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:135)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:167)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$1(MavenBuilder.java:112)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:371)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:228)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$0(MavenBuilder.java:103)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:371)
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.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)
at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:196)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1020)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:247)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:392)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:395)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:506)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:454)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:536)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:196)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:289)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.apache.maven.plugin.MojoExecutionException
at com.cosium.code.format.InstallHooksMojo.execute(InstallHooksMojo.java:95)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeMojo(MavenExecutionContext.java:338)
... 30 more
Caused by: java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:208)
at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:263)
at java.base/java.nio.file.Path.of(Path.java:147)
at java.base/java.nio.file.Paths.get(Paths.java:69)
at com.cosium.code.format.maven.MavenEnvironment.getMavenExecutable(MavenEnvironment.java:45)
at com.cosium.code.format.InstallHooksMojo.writePluginHooks(InstallHooksMojo.java:118)
at com.cosium.code.format.InstallHooksMojo.doExecute(InstallHooksMojo.java:102)
at com.cosium.code.format.InstallHooksMojo.execute(InstallHooksMojo.java:92)
... 32 more
At the same time, I can build the project via Maven on the command line or in IntelliJ IDEA without any problems.
As far as I can tell, the following line of code is causing this NPE: https://github.com/Cosium/git-code-format-maven-plugin/blob/master/core/src/main/java/com/cosium/code/format/maven/MavenEnvironment.java#L45
Thus, it seems as if maven.home is either wrong or undefined.
Environment
- Operating System: Ubuntu Linux 22.04
- JDK version: 17.0.6
- Visual Studio Code version: 1.75
- Java extension version: 1.14
Expected Result
Maven projects should be loaded without errors.
After one of the last plugin updates, opening or building a Maven project that uses the git-code-format-maven-plugin causes the following exception for each child module:
At the same time, I can build the project via Maven on the command line or in IntelliJ IDEA without any problems.
As far as I can tell, the following line of code is causing this NPE: https://github.com/Cosium/git-code-format-maven-plugin/blob/master/core/src/main/java/com/cosium/code/format/maven/MavenEnvironment.java#L45
Thus, it seems as if maven.home is either wrong or undefined.
Environment
Expected Result
Maven projects should be loaded without errors.