git-commit-id/git-commit-id-maven-plugin

`java.lang.NoClassDefFoundError`: `org/eclipse/jgit/internal/JGitText`

dabico opened this issue ยท 6 comments

Describe the bug (required)

After recently upgrading to the next major release, I started getting an error at the end of the build. I think this has something to do with the jgit implementation this plugin ships with, as setting the useNativeGit flag does not produce this error.

Tell us about your plugin configuration (required)

<plugin>
	<groupId>io.github.git-commit-id</groupId>
	<artifactId>git-commit-id-maven-plugin</artifactId>
	<version>8.0.0</version>
	<executions>
		<execution>
			<goals>
				<goal>revision</goal>
			</goals>
			<configuration>
				<commitIdGenerationMode>full</commitIdGenerationMode>
				<generateGitPropertiesFile>true</generateGitPropertiesFile>
				<generateGitPropertiesFilename>
					${project.build.outputDirectory}/git.properties
				</generateGitPropertiesFilename>
				<includeOnlyProperties>
					<includeOnlyProperty>git.branch</includeOnlyProperty>
					<includeOnlyProperty>git.build.time</includeOnlyProperty>
					<includeOnlyProperty>git.build.user.email</includeOnlyProperty>
					<includeOnlyProperty>git.build.user.name</includeOnlyProperty>
					<includeOnlyProperty>git.build.version</includeOnlyProperty>
					<includeOnlyProperty>git.commit.author.time</includeOnlyProperty>
					<includeOnlyProperty>git.commit.committer.time</includeOnlyProperty>
					<includeOnlyProperty>git.commit.id.abbrev</includeOnlyProperty>
					<includeOnlyProperty>git.commit.id.full</includeOnlyProperty>
					<includeOnlyProperty>git.commit.message.short</includeOnlyProperty>
					<includeOnlyProperty>git.commit.message.full</includeOnlyProperty>
					<includeOnlyProperty>git.commit.time</includeOnlyProperty>
					<includeOnlyProperty>git.commit.user.email</includeOnlyProperty>
					<includeOnlyProperty>git.commit.user.name</includeOnlyProperty>
					<includeOnlyProperty>git.remote.origin.url</includeOnlyProperty>
					<includeOnlyProperty>git.tags</includeOnlyProperty>
					<includeOnlyProperty>git.total.commit.count</includeOnlyProperty>
				</includeOnlyProperties>
			</configuration>
		</execution>
	</executions>
</plugin>

Tell us about the Plugin version used (required)

8.0.0

Tell us about the Maven version used (required)

$ mvn --version

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: /usr/local/Cellar/maven/3.9.6/libexec
Java version: 11.0.22, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "14.2.1", arch: "x86_64", family: "mac"

Steps to Reproduce (required)

Just executing mvn -DskipTests=true clean package

Are there any stacktraces or any error messages? (required)

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< ch.usi.si.seart:ghs-application >-------------------
[INFO] Building GitHub Search 1.12.1
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ ghs-application ---
[INFO] Deleting /Users/ozrendabic/Desktop/ghs/target
[INFO]
[INFO] --- git-commit-id:8.0.0:revision (default) @ ghs-application ---
[INFO] dotGitDirectory '/Users/ozrendabic/Desktop/ghs/.git'
[INFO] Collected git.build.user.name with value dabico
[INFO] Collected git.build.user.email with value dabico@usi.ch
[INFO] Collected git.branch with value dependabot/maven/master/io.github.git-commit-id-git-commit-id-maven-plugin-8.0.0
[INFO] Collected git.commit.id.full with value 223d3c5ebd4d71ba9b444f683eaba75e0f73ef37
[INFO] Collected git.commit.id.abbrev with value 223d3c5
[INFO] Collected git.commit.user.name with value dependabot[bot]
[INFO] Collected git.commit.user.email with value 49699333+dependabot[bot]@users.noreply.github.com
[INFO] Collected git.commit.message.full with value Bump io.github.git-commit-id:git-commit-id-maven-plugin

Bumps io.github.git-commit-id:git-commit-id-maven-plugin from 7.0.0 to 8.0.0.


updated-dependencies:

  • dependency-name: io.github.git-commit-id:git-commit-id-maven-plugin
    dependency-type: direct:production
    update-type: version-update:semver-major
    ...

Signed-off-by: dependabot[bot] support@github.com
[INFO] Collected git.commit.message.short with value Bump io.github.git-commit-id:git-commit-id-maven-plugin
[INFO] Collected git.commit.time with value 2024-03-05T01:21:50+01:00
[INFO] Collected git.commit.author.time with value 2024-03-05T01:21:50+01:00
[INFO] Collected git.commit.committer.time with value 2024-03-05T01:21:50+01:00
[INFO] Collected git.remote.origin.url with value https://github.com/seart-group/ghs.git
[INFO] Collected git.tags with value
[INFO] Collected git.total.commit.count with value 2370
[INFO] Collected git.build.time with value 2024-03-06T10:01:09+01:00
[INFO] Collected git.build.version with value 1.12.1
[INFO] including property 'git.tags' in results
[INFO] including property 'git.build.version' in results
[INFO] including property 'git.commit.user.name' in results
[INFO] including property 'git.commit.id.abbrev' in results
[INFO] including property 'git.branch' in results
[INFO] including property 'git.total.commit.count' in results
[INFO] including property 'git.build.user.email' in results
[INFO] including property 'git.commit.message.short' in results
[INFO] including property 'git.commit.committer.time' in results
[INFO] including property 'git.commit.user.email' in results
[INFO] including property 'git.commit.id.full' in results
[INFO] including property 'git.commit.time' in results
[INFO] including property 'git.commit.author.time' in results
[INFO] including property 'git.build.time' in results
[INFO] including property 'git.build.user.name' in results
[INFO] including property 'git.commit.message.full' in results
[INFO] including property 'git.remote.origin.url' in results
[INFO] Writing properties file [/Users/ozrendabic/Desktop/ghs/target/classes/git.properties] (for project GitHub Search)...
[INFO]
[INFO] --- build-helper:3.5.0:add-source (default) @ ghs-application ---
[INFO] Source directory: /Users/ozrendabic/Desktop/ghs/target/generated-sources/annotations added.
[INFO]
[INFO] --- kotlin:1.9.22:compile (default) @ ghs-application ---
[INFO] No sources to compile
[INFO]
[INFO] --- spring-boot:2.7.18:build-info (default) @ ghs-application ---
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ ghs-application ---
[INFO] Copying 1 resource from src/main/resources to target/classes
[INFO] Copying 6 resources from src/main/resources to target/classes
[INFO]
[INFO] --- compiler:3.10.1:compile (default-compile) @ ghs-application ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 172 source files to /Users/ozrendabic/Desktop/ghs/target/classes
[INFO]
[INFO] --- kotlin:1.9.22:compile (compile) @ ghs-application ---
[INFO] No sources to compile
[INFO]
[INFO] --- resources:3.3.1:testResources (default-testResources) @ ghs-application ---
[INFO] skip non existing resourceDirectory /Users/ozrendabic/Desktop/ghs/src/test/resources
[INFO]
[INFO] --- compiler:3.10.1:testCompile (default-testCompile) @ ghs-application ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/ozrendabic/Desktop/ghs/target/test-classes
[INFO]
[INFO] --- kotlin:1.9.22:test-compile (test-compile) @ ghs-application ---
[INFO] No sources to compile
[INFO]
[INFO] --- surefire:2.22.2:test (default-test) @ ghs-application ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- jar:3.2.2:jar (default-jar) @ ghs-application ---
[INFO] Building jar: /Users/ozrendabic/Desktop/ghs/target/ghs-application-1.12.1.jar
[INFO]
[INFO] --- spring-boot:2.7.18:repackage (repackage) @ ghs-application ---
[INFO] Replacing main artifact with repackaged archive
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.330 s
[INFO] Finished at: 2024-03-06T10:01:17+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:840)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jgit.internal.JGitText
... 2 more

Process finished with exit code 0

Is there a (public) project where this issue can be reproduced? (optional)

The project is seart-group/ghs. There is a dedicated branch to this version upgrade: https://github.com/seart-group/ghs/tree/dependabot/maven/master/io.github.git-commit-id-git-commit-id-maven-plugin-8.0.0

Your Environment (optional)

macOS 14.2.1

Context (optional)

No response

Thanks for the report!

I would suspect that this is related to the version update of the jgit dependency performed in https://github.com/git-commit-id/git-commit-id-plugin-core/releases/tag/v6.0.0-rc.7.

In particular:
bump jgit.version from 6.7.0.202309050840-r to 6.8.0.202311291450-r

The release notes do not mention anything in particular regarding this issue (https://projects.eclipse.org/projects/technology.jgit/releases/6.8.0/)

For now I can confirm that I see the issue when looking at the build from one of the linked issues (https://github.com/FraunhoferIOSB/FAAAST-Service/actions/runs/8173789615/job/22347018676?pr=688)

I guess what makes this super frustrating is that I can even see it inside the Run the local testversion with Maven integration tests that are performed whenever this plugin is build (e.g. https://github.com/git-commit-id/git-commit-id-maven-plugin/actions/runs/8146847392/job/22266267434).
Why this is Exception is not causing the process to report a status code != 0 might be some other problem and I guess still a mystery is why I didn't see the issue locally yet....

Will try to troubleshoot this...

I can reproduce the issue locally.

For counter measures I have added now instructions to my release template to run the plugin before releasing. I thought I did that, but apparently not. The fact that the github actions do not fail still trips me off.

As per eclipse-jgit/jgit#17 (comment) there is already a 6.9.0.202403050737-r release to become available soon.

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 eclipse-jgit/jgit@v6.8.0.202311291450-r...v6.9.0.202403050737-r

  2. revert to 6.7.0.202309050840-r

This remains an issue with 6.9.0.202403050737-r.
See: eclipse-jgit/jgit#36 (comment)

I released a 8.0.1 now, that main purpose is to downgrade the jgit.version from 6.8.0.202311291450-r to 6.7.0.202309050840-r. See full release notes https://github.com/git-commit-id/git-commit-id-maven-plugin/releases/tag/v8.0.1

Thanks again for the report.
I'm going ahead and close this now.

This remains an issue with 6.9.0.202403050737-r. See: eclipse-jgit/jgit#36 (comment)

Thanks for sharing the link. I ran into at work on a private plugin and it was sort of the same. The plugin actually worked but at end of the run threw the issue. I ended up just rolling back too but didn't have time or ability there to dig into it more. I was hoping they fixed in 6.9 that just got released but guess that wasn't the case. Knowing this is still an issue though helps me not repeat the same problem with 6.9 or even bother testing it now :)