【发布时间】:2021-12-07 13:16:43
【问题描述】:
我有一个项目使用 com.cosium.code 中的 git-code-format-maven-plugin 将代码格式化为预提交挂钩。我正在设置一个构建管道来安装这个项目,并且运行机器没有安装 git。
所以插件抛出异常
无法在项目 chat-srv 上执行目标 com.cosium.code:git-code-format-maven-plugin:3.1:install-hooks(默认):必须调用 setGitDir 或 setWorkTree 之一。 -> [帮助 1]
我正在执行的命令是mvn -f /app/pom.xml clean install
是否可以在 mvn 安装期间跳过代码格式化并仅对 git 提交启用它?或者是否可以在管道构建期间跳过使用插件?
pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>com.cosium.code</groupId>
<artifactId>git-code-format-maven-plugin</artifactId>
<version>3.1</version>
<executions>
<execution>
<goals>
<goal>install-hooks</goal>
</goals>
</execution>
</executions>
<configuration>
<googleJavaFormatOptions>
<aosp>true</aosp>
</googleJavaFormatOptions>
</configuration>
</plugin>
</plugins>
</build>
【问题讨论】:
标签: maven maven-plugin code-formatting