Skip to content

Commit 80f19bc

Browse files
evil0thHccake
authored andcommittedApr 22, 2024
🔧 补齐插件及git hook配置
1 parent 19e4cca commit 80f19bc

File tree

3 files changed

+93
-1
lines changed

3 files changed

+93
-1
lines changed
 

‎.etc/git-hooks/pre-commit

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
# 在提交前进行校验
3+
mvn validate
4+
5+
# 检查 mvn validate 的退出状态
6+
if [ $? -ne 0 ]; then
7+
echo "Maven validate failed, aborting commit."
8+
exit 1
9+
fi

‎ballcat-business-bom/pom.xml

-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@
212212
<goals>
213213
<goal>validate</goal>
214214
</goals>
215-
<inherited>true</inherited>
216215
<phase>validate</phase>
217216
</execution>
218217
</executions>

‎pom.xml

+84
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,18 @@
144144

145145
<build>
146146
<plugins>
147+
<plugin>
148+
<groupId>io.spring.javaformat</groupId>
149+
<artifactId>spring-javaformat-maven-plugin</artifactId>
150+
<executions>
151+
<execution>
152+
<goals>
153+
<goal>validate</goal>
154+
</goals>
155+
<phase>validate</phase>
156+
</execution>
157+
</executions>
158+
</plugin>
147159
<plugin>
148160
<groupId>org.apache.maven.plugins</groupId>
149161
<artifactId>maven-compiler-plugin</artifactId>
@@ -177,6 +189,78 @@
177189
<target>${maven.compiler.target}</target>
178190
</configuration>
179191
</plugin>
192+
<!-- 测试插件 -->
193+
<plugin>
194+
<groupId>org.apache.maven.plugins</groupId>
195+
<artifactId>maven-surefire-plugin</artifactId>
196+
<configuration>
197+
<argLine>-Dfile.encoding=UTF-8</argLine>
198+
</configuration>
199+
</plugin>
200+
<plugin>
201+
<groupId>org.codehaus.mojo</groupId>
202+
<artifactId>flatten-maven-plugin</artifactId>
203+
<configuration>
204+
<flattenMode>resolveCiFriendliesOnly</flattenMode>
205+
<updatePomFile>true</updatePomFile>
206+
</configuration>
207+
<executions>
208+
<execution>
209+
<goals>
210+
<goal>flatten</goal>
211+
</goals>
212+
<id>flatten</id>
213+
<phase>process-resources</phase>
214+
</execution>
215+
<execution>
216+
<goals>
217+
<goal>clean</goal>
218+
</goals>
219+
<id>flatten.clean</id>
220+
<phase>clean</phase>
221+
</execution>
222+
</executions>
223+
</plugin>
224+
<!-- git hook 配置 -->
225+
<plugin>
226+
<groupId>com.rudikershaw.gitbuildhook</groupId>
227+
<artifactId>git-build-hook-maven-plugin</artifactId>
228+
<configuration>
229+
<gitConfig>
230+
<!-- The location of the directory you are using to store the Git hooks in your project. -->
231+
<core.hooksPath>.etc/git-hooks/</core.hooksPath>
232+
</gitConfig>
233+
</configuration>
234+
<executions>
235+
<execution>
236+
<goals>
237+
<!-- Sets git config specified under configuration > gitConfig. -->
238+
<goal>configure</goal>
239+
</goals>
240+
</execution>
241+
</executions>
242+
</plugin>
243+
<!-- checkstyle 配置 -->
244+
<plugin>
245+
<groupId>org.apache.maven.plugins</groupId>
246+
<artifactId>maven-checkstyle-plugin</artifactId>
247+
<executions>
248+
<execution>
249+
<id>checkstyle-validation</id>
250+
<phase>validate</phase>
251+
<configuration>
252+
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
253+
<suppressionsLocation>src/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
254+
<consoleOutput>true</consoleOutput>
255+
<failsOnError>true</failsOnError>
256+
<includeTestSourceDirectory>true</includeTestSourceDirectory>
257+
</configuration>
258+
<goals>
259+
<goal>check</goal>
260+
</goals>
261+
</execution>
262+
</executions>
263+
</plugin>
180264
</plugins>
181265
</build>
182266
<developers>

0 commit comments

Comments
 (0)
Please sign in to comment.