git-changelog-maven-plugin icon indicating copy to clipboard operation
git-changelog-maven-plugin copied to clipboard

[ERROR] GitChangelog java.lang.NullPointerException

Open MikalaiHarnouski opened this issue 2 years ago • 3 comments

  1. I have mvn 3.8.3 and Java 11.0.5.
  2. plugin uses javascriptHelper

Plugin:

image

trace-log:

[INFO] --- git-changelog-maven-plugin:1.92:git-changelog (GenerateGitChangelog) @ git-log --- [INFO] Extended variables: [ERROR] GitChangelog java.lang.NullPointerException at com.github.jknack.handlebars.helper.DefaultHelperRegistry.engine (DefaultHelperRegistry.java:304) at com.github.jknack.handlebars.helper.DefaultHelperRegistry.registerHelpers (DefaultHelperRegistry.java:193) at com.github.jknack.handlebars.Handlebars.registerHelpers (Handlebars.java:859) at se.bjurr.gitchangelog.api.GitChangelogApi.withHandlebarsHelper (GitChangelogApi.java:244) at se.bjurr.gitchangelog.plugin.GitChangelogMojo.execute (GitChangelogMojo.java:199) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) [INFO]

MikalaiHarnouski avatar Jun 03 '22 13:06 MikalaiHarnouski

I think this should be filed on the Handlebars.java library that this tool uses. I found an issue but it does not contain any information: https://github.com/jknack/handlebars.java/issues/808

tomasbjerre avatar Jun 06 '22 06:06 tomasbjerre

I had the same problem with Temurin JDK 11 : nashorn seems to be missing from non-Oracle JDKs. To fix the issue, you just have to add an explicit dependency for the plugin in the POM.xml file:

<!-- Plugin Git Changelog -->
<plugin>
  <groupId>se.bjurr.gitchangelog</groupId>
  <artifactId>git-changelog-maven-plugin</artifactId>
  <version>1.92</version>
  <dependencies>
    <!-- Nashorn required to enable custom JS helper with non-Oracle JDK -->
    <dependency>
      <groupId>org.openjdk.nashorn</groupId>
      <artifactId>nashorn-core</artifactId>
      <version>15.4</version>
    </dependency>
  </dependencies>
</plugin>

jpi-seb avatar Sep 21 '22 20:09 jpi-seb

Thanks. It helped me.

MikalaiHarnouski avatar Sep 22 '22 06:09 MikalaiHarnouski