Skip to content

Plugin fails with git submodule involved #701

Closed
@Arsnael

Description

@Arsnael

Describe the bug (required)

The community in Apache James project (https://github.com/apache/james-project) upgrade recently this plugin from version 4.9.10 to 7.0.0 : apache/james-project@88e1ae8

For the TMail backend project using Apache james as a submodule to implement extra features on top, it creates the following issue when trying to upgrade our project to latest version of the submodule:

[ERROR] Failed to execute goal io.github.git-commit-id:git-commit-id-maven-plugin:7.0.0:revision (get-the-git-infos) on project testing-base: Git command exited with invalid status [128]: directory: `/home/jenkins/build/workspace/Tmail_build_PR-932/.git/modules`, command: `git describe --always --dirty=-dirty --match=* --abbrev=7`, stdout: ``, stderr: `fatal: this operation must be run in a work tree` -> [Help 1]

PR: linagora/tmail-backend#932

It seems similar to this issue: #639 that has been solved and merged into 7.0.0 it seems (cf #642).

Except that I actually never really used worktrees in the first place? Is there some conflict perhaps?

Tell us about your plugin configuration (required)

It comes from the Apache James project that is used as a submodule into TMail project

<plugin>
    <groupId>io.github.git-commit-id</groupId>
    <artifactId>git-commit-id-maven-plugin</artifactId>
    <version>7.0.0</version>
</plugin>

...

<plugin>
    <groupId>io.github.git-commit-id</groupId>
    <artifactId>git-commit-id-maven-plugin</artifactId>
    <configuration>
        <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
        <injectAllReactorProjects>true</injectAllReactorProjects>
        <generateGitPropertiesFile>true</generateGitPropertiesFile>
        <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
        <failOnNoGitDirectory>false</failOnNoGitDirectory>
        <format>json</format>
        <gitDescribe>
            <skip>false</skip>
            <always>true</always>
            <dirty>-dirty</dirty>
        </gitDescribe>
        <includeOnlyProperties>
            <includeOnlyProperty>git.commit.id</includeOnlyProperty>
            <includeOnlyProperty>git.commit.id.describe</includeOnlyProperty>
            <includeOnlyProperty>git.commit.message.short</includeOnlyProperty>
            <includeOnlyProperty>git.dirty</includeOnlyProperty>
        </includeOnlyProperties>
        <prefix>git</prefix>
        <skip>false</skip>
        <useNativeGit>true</useNativeGit>
        <verbose>false</verbose>
    </configuration>
    <executions>
        <execution>
            <id>get-the-git-infos</id>
            <goals>
                <goal>revision</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Tell us about the Plugin version used (required)

7.0.0

Tell us about the Maven version used (required)

mvn --version
Apache Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9)
Maven home: /home/rene/.sdkman/candidates/maven/current
Java version: 17.0.8.1, vendor: Eclipse Adoptium, runtime: /home/rene/.sdkman/candidates/java/17.0.8.1-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.6.16-275.current", arch: "amd64", family: "unix"

Steps to Reproduce (required)

  1. Clone tmail backend forked project: https://github.com/Arsnael/tmail-backend
  2. Checkout branch james-sub-upgrade-2
  3. Initialize submodule:
git submodule init
git submodule update
  1. Try to build:
mvn clean install -DskipTests

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

mvn clean install -Dmaven.javadoc.skip=true -DskipTests -T1C
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.193 s (Wall Clock)
[INFO] Finished at: 2024-02-22T17:14:27+07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.github.git-commit-id:git-commit-id-maven-plugin:7.0.0:revision (get-the-git-infos) on project testing-base: Git command exited with invalid status [128]: directory: `/home/rene/Dev/github/tmail-backend/.git/modules`, command: `git describe --always --dirty=-dirty --match=* --abbrev=7`, stdout: ``, stderr: `fatal: this operation must be run in a work tree` -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :testing-base

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

https://github.com/Arsnael/tmail-backend

Your Environment (optional)

git version 2.43.1

Context (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions