tomasbjerre / git-changelog-maven-plugin

Maven plugin that can generate a changelog, or releasenotes, from git repository
Other
80 stars 36 forks source link

ClassNotFoundException: org.eclipse.jgit.internal.JGitText with jdk21 and spring boot 3.2.x #62

Open ilopezv opened 8 months ago

ilopezv commented 8 months ago

Building a project with maven 3.9.6, git-changelog-maven-plugin 2.1.0, spring-boot 3.2.x and jdk21 or graalvm21, build execution works as normal but at the end maven output the following error

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  23.178 s (Wall Clock)
[INFO] Finished at: 2024-02-24T12:31:28+01:00
[INFO] ------------------------------------------------------------------------
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: org/eclipse/jgit/internal/JGitText
        at org.eclipse.jgit.internal.util.ShutdownHook.cleanup(ShutdownHook.java:85)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jgit.internal.JGitText
        ... 2 more

plugin configuration is the default provided by spring boot parent

        <plugin>
          <groupId>se.bjurr.gitchangelog</groupId>
          <artifactId>git-changelog-maven-plugin</artifactId>
          <version>2.1.0</version>
          <dependencies>
          <executions>
            <execution>
              <id>git-changelog-compile</id>
              <goals>
                <goal>git-changelog</goal>
              </goals>
              <phase>generate-sources</phase>
              <configuration>
                <dateFormat>dd-MM-yyyy HH:mm:ss</dateFormat>
                <timeZone>UTC</timeZone>
                <ignoreCommitsIfMessageMatches>^chore:\[maven-release-plugin\].*</ignoreCommitsIfMessageMatches>
                <file>CHANGELOG.md</file>
                <templateFile>changelog.mustache</templateFile>
                <untaggedName>Current SNAPSHOT</untaggedName>
                <skip>${git-changelog.skip}</skip>
              </configuration>
            </execution>
          </executions>
        </plugin>
tomasbjerre commented 8 months ago

I tried it with java 21:

12:49 $ ./mvnw --version
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: /home/bjerre/.m2/wrapper/dists/apache-maven-3.9.6-bin/439sdfsg2nbdob9ciift5h5nse/apache-maven-3.9.6
Java version: 21.0.1, vendor: Private Build, runtime: /usr/lib/jvm/java-21-openjdk-amd64
Default locale: sv_SE, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-94-generic", arch: "amd64", family: "unix"

Running the ./build.sh in this repo. Works for me.

Is it just an exception or does it also not work as expected?

ilopezv commented 8 months ago

is it just an exception, it works well.

mvn --version
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: C:\apache-maven-3.9.6
Java version: 21.0.2, vendor: GraalVM Community, runtime: C:\Users\nakku\.jenv\versions\21
Default locale: es_ES, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Here you have and output from mvn generate-resources -X

debug-output.txt

ilopezv commented 8 months ago

Same problem happens in plugin git-commit-id-maven-plugin, the problem is a change in the library eclipse-jgit, and the solution is posted below

https://github.com/git-commit-id/git-commit-id-maven-plugin/issues/712

So I guess there are two options:

1. Go with the 6.9.0 release and "risk" that there is something else broken.
See https://projects.eclipse.org/projects/technology.jgit/releases/6.9.0 or https://github.com/eclipse-jgit/jgit/compare/v6.8.0.202311291450-r...v6.9.0.202403050737-r

2. revert to 6.7.0.202309050840-r
ilopezv commented 8 months ago

I confirm that the following snippet fix the issue:

        <plugin>
          <groupId>se.bjurr.gitchangelog</groupId>
          <artifactId>git-changelog-maven-plugin</artifactId>
          <dependencies>
            <dependency>
              <groupId>org.eclipse.jgit</groupId>
              <artifactId>org.eclipse.jgit</artifactId>
              <version>6.7.0.202309050840-r</version>
            </dependency>
          </dependencies>
        </plugin>

Version 6.9.0 y not in maven central yet

TheSnoozer commented 8 months ago

the 6.9.0 is now published to maven central, but it doesn't fix the problem with ClassNotFoundException: org.eclipse.jgit.internal.JGitText

See https://github.com/eclipse-jgit/jgit/issues/36#issuecomment-1986838676