-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpom.xml
485 lines (450 loc) · 21 KB
/
pom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.JoeKerouac</groupId>
<artifactId>async-task</artifactId>
<version>4.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>async-task</name>
<description>异步任务调度框架</description>
<url>https://github.com/JoeKerouac/async-task</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<scm>
<url>https://github.com/JoeKerouac/async-task</url>
<connection>scm:git:https://github.com/JoeKerouac/async-task.git</connection>
<developerConnection>scm:git:https://github.com/JoeKerouac/async-task.git</developerConnection>
</scm>
<developers>
<developer>
<name>JoeKerouac</name>
<email>[email protected]</email>
</developer>
</developers>
<modules>
<module>core</module>
<module>starter</module>
</modules>
<properties>
<jacoco.version>0.8.6</jacoco.version>
<spotbugs.version>4.1.4</spotbugs.version>
<checkstyle.version>3.1.1</checkstyle.version>
<build.java.version>1.8</build.java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<format.action>format</format.action>
<!-- 原始源码目录,我们后边要将源码目录切换到delombok.dir中 -->
<origin.source.dir>src/main/java</origin.source.dir>
<!-- 打包生成source时使用的目录 -->
<source.generate.dir>src/main/java</source.generate.dir>
<!-- lombok生成源码的目录 -->
<delombok.dir>${project.build.directory}/delombok</delombok.dir>
<!-- jacoco的行覆盖率最小值 -->
<jacoco.coveredratio.line>0.60</jacoco.coveredratio.line>
<license.maven.plugin>3.0</license.maven.plugin>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.JoeKerouac</groupId>
<artifactId>async-task-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<!-- 使用delombok生成的源码目录作为项目的源码目录 -->
<sourceDirectory>${source.generate.dir}</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${build.java.version}</source>
<target>${build.java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<compilerArgs>
<!-- 不对项目中使用过时API的行为警告 -->
<arg>-Xlint:deprecation</arg>
</compilerArgs>
</configuration>
</plugin>
<!-- site插件显式声明,做一些个性化配置 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.9.0</version>
<configuration>
<!-- 指定环境为中文环境 -->
<locales>zh</locales>
<!-- 指定输出目录 -->
<outputDirectory>${project.build.directory}/site</outputDirectory>
<relativizeDecorationLinks>false</relativizeDecorationLinks>
</configuration>
</plugin>
<!-- 代码格式化插件,自动格式化代码使之格式统一 -->
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>2.13.0</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<configFile>${project.parent.basedir}/Formatter.xml</configFile>
<sourceDirectory>${origin.source.dir}</sourceDirectory>
</configuration>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>${format.action}</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<argLine>-Dasync.task.pid.max=100000 -Dfile.encoding=UTF8</argLine>
</configuration>
</plugin>
<!-- 添加license头 -->
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>${license.maven.plugin}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>remove</goal>
<goal>format</goal>
</goals>
</execution>
</executions>
<configuration>
<quiet>true</quiet>
<header>HEADER</header>
<includes>
<include>**/src/main/java/**</include>
<include>**/src/test/java/**</include>
</includes>
<strictCheck>true</strictCheck>
<mapping>
<java>SLASHSTAR_STYLE</java>
</mapping>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>${maven.repo.id}</id>
<name>maven仓库</name>
<url>${maven.snapshot.repo}</url>
</snapshotRepository>
<repository>
<id>${maven.repo.id}</id>
<name>maven仓库</name>
<url>${maven.repo}</url>
</repository>
</distributionManagement>
<profiles>
<!-- 如果需要将构建发布到私服,请配置下面的环境变量,发布时激活该profile即可 -->
<profile>
<id>local</id>
<properties>
<maven.repo.id>nexus</maven.repo.id>
<maven.repo>${env.MVN_REPO}</maven.repo>
<maven.snapshot.repo>${env.MVN_SNAPSHOTS_REPO}</maven.snapshot.repo>
</properties>
</profile>
<profile>
<id>central</id>
<properties>
<maven.repo.id>maven-central</maven.repo.id>
<maven.repo>https://oss.sonatype.org/service/local/staging/deploy/maven2</maven.repo>
<maven.snapshot.repo>https://oss.sonatype.org/content/repositories/snapshots</maven.snapshot.repo>
</properties>
</profile>
<profile>
<!-- 发布profile -->
<id>release</id>
<properties>
<!-- 发布阶段将format的功能切换为验证而不是格式化 -->
<format.action>validate</format.action>
<source.generate.dir>${delombok.dir}</source.generate.dir>
</properties>
<build>
<plugins>
<!-- lombok插件,用于将源码中的lombok相关注解替换为对应的代码 -->
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>1.18.16.0</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<!-- 指定要解除lombok注释的代码在这个目录中 -->
<sourceDirectory>${origin.source.dir}</sourceDirectory>
<!--
delombok后的源码默认是输出到target/generated-sources/delombok目录中的,这里我们修改输出到我们指定的目录,因为
如果输出到target/generated-sources中会导致IDEA也将其识别为源码,最终就是导致IDEA报错,因为class重复
-->
<outputDirectory>${delombok.dir}</outputDirectory>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>delombok</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- check style插件,对源码进行扫描 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.version}</version>
<configuration>
<!-- 注意,我们要对原始源码进行check style检查,而不是当前delombok生成的源码,所以这里要手动切换目录 -->
<sourceDirectories>${origin.source.dir}</sourceDirectories>
<configLocation>checkstyle.xml</configLocation>
<encoding>${project.build.sourceEncoding}</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 覆盖率统计,jacoco用法参照:https://www.eclemma.org/jacoco/trunk/doc/maven.html -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<title>async-task测试用例覆盖率报告</title>
<!-- 将下面的包排除不统计覆盖率 -->
<excludes>
</excludes>
</configuration>
</execution>
<execution>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<!-- 将下面的包排除不统计覆盖率 -->
<excludes>
</excludes>
<!-- 指标检查 -->
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<!-- 行覆盖率检查 -->
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coveredratio.line}</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<!-- Source -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<!-- jdk1.8要加上,1.7要去掉,否则会报错 -->
<additionalJOptions>
<additionalJOption>${javadoc.opts}</additionalJOption>
</additionalJOptions>
</configuration>
</plugin>
<!-- spotbugs检查(findbugs的替代品),spotbugs运行在编译后,对class文件进行扫描 -->
<!-- 错误描述页面:https://spotbugs.readthedocs.io/en/latest/bugDescriptions.html -->
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>${spotbugs.version}</version>
<configuration>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
<effort>Max</effort>
<!-- 如果bug级别大于等于该值将阻断流程 -->
<threshold>High</threshold>
</configuration>
<executions>
<execution>
<id>verify</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Gpg Signature -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- 禁用注释检查 -->
<profile>
<id>disable-javadoc-doclint</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<properties>
<javadoc.opts>-Xdoclint:none</javadoc.opts>
</properties>
</profile>
</profiles>
<reporting>
<plugins>
<!-- 项目基本信息report -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.6</version>
<reportSets>
<reportSet>
<reports><!-- select reports -->
<report>index</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<!-- jacoco报告,依赖于build结果 -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<reportSets>
<reportSet>
<reports>
<!-- 单独的报告 -->
<report>report</report>
</reports>
</reportSet>
</reportSets>
<configuration>
<title>测试用例覆盖率报告</title>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
</configuration>
</plugin>
<!-- findBug报告,因为是运行在class文件上,所以需要先compile -->
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>${spotbugs.version}</version>
</plugin>
<!-- check-style的报告 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<!-- 注意,我们要对原始源码进行check style检查,而不是当前delombok生成的源码,所以这里要手动切换目录 -->
<sourceDirectories>${origin.source.dir}</sourceDirectories>
<configLocation>checkstyle.xml</configLocation>
<encoding>${project.build.sourceEncoding}</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<!-- 测试用例执行报告,依赖于测试用例结果,所以需要先跑测试用例,然后这个才会生成报告 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>3.0.0-M7</version>
<reportSets>
<reportSet>
<reports>
<!-- 注意,这里只报告,不要选择report,否则这里会重复执行一次测试用例 -->
<report>report-only</report>
</reports>
</reportSet>
</reportSets>
<configuration>
<title>测试报告</title>
</configuration>
</plugin>
</plugins>
</reporting>
</project>