我有一个类似于问here的问题,但没有答案。在maven项目中有以下结构(这是标准的):
parent-pom - which is a parent for all others
|_reactor - which is a concrete project, parent-pom is a parent
|_module_1 - reactor is a parent
|_module_2
...
|_module_ngit-commit-id-plugin在parent-pom中配置,而不是在其他地方配置。
直到最近,一切都很好:我能够使用mvn clean分别构建整个反应堆项目和所有模块。然后我添加了一个新的模块(假设是module_n1),我相信在大规模合并之前,构建过程一直很顺利。现在我得到了以下情况:反应堆构建成功,每个模块分别从1到n个构建成功。但module_n1失败,并显示以下错误:
[ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:2.1.7:revision (default) on project module_n1: .git directory could not be found! Please specify a valid [dotGitDirectory] in your pom.xml在reactor模块下有一个.git文件夹。作为实验,我删除了它,并在其他模块中得到了相同的错误。
在构建过程中,某个特定模块找不到.git文件夹的原因可能是什么?
谢谢。
发布于 2018-06-11 17:33:31
从2.0.4版本开始,标志failOnNoGitDirectory默认是true。将标志设置为false,以确保在.git目录不存在时跳过此目标。
<build>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<configuration>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
</configuration>
</plugin>
</plugins>
</build>该插件具有在项目的当前目录和父目录中搜索.git存储库的内部逻辑。如果多模块项目位于相同的git存储库下,我不会太担心。
发布于 2015-09-09 14:14:45
我今天遇到了这个问题,看看这个文档很好的maven插件,解决方案就很清楚了:
https://github.com/ktoso/maven-git-commit-id-plugin在这里,你在'module_n1‘中声明了插件,并且在那个文件夹中没有.git目录。如果.git目录在父目录中,则解决方案是按如下方式配置插件。反应堆):
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.1.15</version>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<dotGitDirectory>${project.basedir}/../.git</dotGitDirectory>
<!-- more config here as you see fit -->
</configuration>
</plugin>发布于 2017-03-01 22:54:05
这不是一个解决方案,但是如果你想跳过在父pom中定义的git-commit-id-plugin执行,直到项目被添加到git中,你可以覆盖你的pom中的执行。
<pluginManagement>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>https://stackoverflow.com/questions/31173467
复制相似问题