jgitver-maven-plugin icon indicating copy to clipboard operation
jgitver-maven-plugin copied to clipboard

git worktree with jgitver

Open benjamingarcia opened this issue 7 years ago • 2 comments

Issue

1.2.1: replace with the version of the jgtiver-maven-plugin you have the issue with

usage context:

  • [x] maven command line: 3.5.2
  • [ ] eclipse: replace with version
  • [ ] netbeans: replace with version
  • [ ] Intellij IDEA: replace with version

Problem description:

  • I use git worktree since a few weeks, and when I try to build with maven, I have this error :

[WARNING] cannot autoclose GitVersionCalculator object for project: /home/dev/projet/fix
java.lang.IllegalStateException: failure calculating version
    at fr.brouillard.oss.jgitver.GitVersionCalculator.buildVersion (GitVersionCalculator.java:312)
    at fr.brouillard.oss.jgitver.GitVersionCalculator.getVersionObject (GitVersionCalculator.java:144)
    at fr.brouillard.oss.jgitver.GitVersionCalculator.getVersion (GitVersionCalculator.java:203)
    at fr.brouillard.oss.jgitver.GitVersionCalculator.meta (GitVersionCalculator.java:512)
    at fr.brouillard.oss.jgitver.JGitverExtension.afterSessionStart (JGitverExtension.java:93)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:210)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    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)
Caused by: org.eclipse.jgit.errors.NoWorkTreeException: Bare Repository has neither a working tree, nor an index
    at org.eclipse.jgit.lib.Repository.getWorkTree (Repository.java:1356)
    at org.eclipse.jgit.treewalk.FileTreeIterator.<init> (FileTreeIterator.java:115)
    at org.eclipse.jgit.treewalk.FileTreeIterator.<init> (FileTreeIterator.java:97)
    at org.eclipse.jgit.api.StatusCommand.call (StatusCommand.java:139)
    at fr.brouillard.oss.jgitver.impl.GitUtils.isDirty (GitUtils.java:51)
    at fr.brouillard.oss.jgitver.GitVersionCalculator.buildVersion (GitVersionCalculator.java:209)
    at fr.brouillard.oss.jgitver.GitVersionCalculator.getVersionObject (GitVersionCalculator.java:144)
    at fr.brouillard.oss.jgitver.GitVersionCalculator.getVersion (GitVersionCalculator.java:203)
    at fr.brouillard.oss.jgitver.GitVersionCalculator.meta (GitVersionCalculator.java:512)
    at fr.brouillard.oss.jgitver.JGitverExtension.afterSessionStart (JGitverExtension.java:93)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:210)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    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)

But I think it´s more about jGit jgit issue

benjamingarcia avatar May 18 '18 14:05 benjamingarcia

Hi Benjamin, thanks for reporting.

Indeed jgitver relies on jgit for that git parsing so if worktree breaks jgit, then jgitver is also broken.

McFoggy avatar May 18 '18 15:05 McFoggy

This seems to be resolved by https://github.com/jgitver/jgitver/commit/e42d69b2aa2d05bd38433f50fd00d75153380412 Could you release a new version, please?

chrko avatar May 17 '20 17:05 chrko