-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpom.xml
More file actions
675 lines (660 loc) · 30.6 KB
/
Copy pathpom.xml
File metadata and controls
675 lines (660 loc) · 30.6 KB
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
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
<?xml version="1.0" encoding="UTF-8"?>
<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">
<artifactId>UltiTools-API</artifactId>
<groupId>com.ultikits</groupId>
<version>6.2.5</version>
<modelVersion>4.0.0</modelVersion>
<name>UltiTools-API</name>
<description>This project is the base of the Ultitools plugin development.</description>
<url>https://dev.ultikits.com/</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://raw.githubusercontent.com/UltiKits/UltiTools-Reborn/main/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<connection>scm:git@github.com:UltiKits/UltiTools-Reborn.git</connection>
<developerConnection>scm:git@github.com:UltiKits/UltiTools-Reborn.git</developerConnection>
<url>https://github.com/UltiKits/UltiTools-Reborn</url>
</scm>
<developers>
<developer>
<name>wisdomme</name>
<email>xia.erich03@gmail.com</email>
<organization>UltiKits</organization>
<timezone>+10</timezone>
</developer>
</developers>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<gui.version>4.3.0</gui.version>
<!-- Default excluded test groups - override with -DexcludedGroups= to run isolated tests -->
<excludedGroups>isolated</excludedGroups>
<!-- Default API URL for production; override with -Dultitools.api.url=http://localhost:8787 for dev -->
<ultitools.api.url>https://api.ultikits.com</ultitools.api.url>
<!--
Target folder for the ultitools-maven-plugin deploy goal. Defaults to a directory inside
target/ so a clean checkout never writes outside the project. Developers who want the
built JAR copied straight into a local test server should override it locally, either
with -Dultitools.deploy.folder=/path/to/server/plugins on the command line or with a
profile in ~/.m2/settings.xml. Do not hard-code a machine-specific path here.
-->
<ultitools.deploy.folder>${project.build.directory}/deploy</ultitools.deploy.folder>
</properties>
<distributionManagement>
<snapshotRepository>
<id>ultikits-sonatype</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ultikits-sonatype</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<flattenMode>ossrh</flattenMode>
<pomElements>
<dependencies>remove</dependencies>
</pomElements>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>1.18.20.0</version>
<configuration>
<encoding>UTF-8</encoding>
<sourceDirectory>src/main/java</sourceDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.38</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<!--
Animal Sniffer — 看守 Java 8 API 边界。
编译用的是 source/target 1.8 而不是 <release>8</release>,所以 javac
链接的是 JDK 21 的类库:误用 Java 9+ 的 API(String.strip、List.of、
Map.entry 等)能编译通过,直到在真 Java 8 上运行才抛 NoSuchMethodError。
这里在字节码层比对 java18 签名,把那个缺口补上。
不要改用 <release>8</release> —— 它会拒绝本项目已在使用的
@Deprecated(since=, forRemoval=),而那些元数据是废弃契约的一部分。
Animal Sniffer — guards the Java 8 API boundary.
The build uses source/target 1.8 rather than <release>8</release>, so
javac links against the JDK 21 class library and Java 9+ API calls
compile cleanly, only failing with NoSuchMethodError on a real Java 8
runtime. This checks the emitted bytecode against the java18 signature.
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.27</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
</configuration>
<executions>
<execution>
<id>check-java18-api</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<!-- Exclude tests tagged as 'isolated' - they must run separately -->
<!-- To run isolated tests: mvn test -Dtest=JsonStoreTest -DskipExcludedGroups=true -->
<excludedGroups>${excludedGroups}</excludedGroups>
</configuration>
</plugin>
<!-- JaCoCo 覆盖率插件 -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<!-- 准备代理 -->
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- 生成报告 -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<!-- 覆盖率检查 (可选,暂时注释以避免构建失败) -->
<!--
<execution>
<id>check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.70</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
-->
</executions>
<configuration>
<excludes>
<!-- 排除生成的代码 -->
<exclude>**/*$$*</exclude>
<!-- 排除纯数据类 -->
<exclude>**/entity/*Entity.class</exclude>
</excludes>
</configuration>
</plugin>
<!--发布源码插件 -->
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-source-plugin</artifactId>-->
<!-- <version>2.2.1</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <phase>package</phase>-->
<!-- <goals>-->
<!-- <goal>jar</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<!-- 清单文件 -->
<manifest>
<mainClass>com.ultikits.ultitools.UltiTools</mainClass>
</manifest>
</archive>
<!-- 指定需要把哪些文件打入到jar包中, -->
<!-- ** 代表jar包根目录 -->
<!-- **/com/ 代表jar包根目录下仅包含com目录(我所有的程序都在com包下), 当然打好之后还会包含生成的manifest目录 -->
<!-- 注意com后面的/一定不要省去,不然maven会认为这是一个文件名 -->
<!-- includes或者excludes一定要指定,不然会把target下所有的文件都打进去 -->
<includes>
<!-- <include>**/com/ultikits/</include>-->
<include>**/</include>
</includes>
<excludes>
<exclude>**/mappings/</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>false</minimizeJar>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>META-INF/LICENSE*</exclude>
<exclude>META-INF/NOTICE*</exclude>
<exclude>META-INF/DEPENDENCIES</exclude>
<exclude>META-INF/maven/**</exclude>
<exclude>META-INF/versions/**</exclude>
<exclude>META-INF/native-image/**</exclude>
<exclude>META-INF/proguard/**</exclude>
<exclude>META-INF/services/java.sql.Driver</exclude>
<exclude>META-INF/*.kotlin_module</exclude>
<exclude>**/module-info.class</exclude>
<exclude>LICENSE*</exclude>
<exclude>NOTICE*</exclude>
<exclude>about.html</exclude>
<exclude>changelog.txt</exclude>
<exclude>DebugProbesKt.bin</exclude>
</excludes>
</filter>
<!-- 排除 obliviate-invs 子模块中的重复 UniversalScheduler 类 -->
<filter>
<artifact>com.github.hamza-cskn.obliviate-invs:advancedslot</artifact>
<excludes>
<exclude>com/github/Anon8281/universalScheduler/**</exclude>
</excludes>
</filter>
<filter>
<artifact>com.github.hamza-cskn.obliviate-invs:core</artifact>
<excludes>
<exclude>com/github/Anon8281/universalScheduler/**</exclude>
<exclude>mc/obliviate/util/versiondetection/**</exclude>
</excludes>
</filter>
<filter>
<artifact>com.github.hamza-cskn.obliviate-invs:configurablegui</artifact>
<excludes>
<exclude>mc/obliviate/util/versiondetection/**</exclude>
</excludes>
</filter>
</filters>
<!-- 防止 minimizeJar 移除反射加载的类 -->
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.ultikits.ultitools.UltiTools</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<!-- 拷贝依赖的jar包到lib目录 (已移除,改为shade打包) -->
<!-- 解决资源文件的编码问题 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- 打包source文件为jar文件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<configuration>
<show>private</show>
<nohelp>true</nohelp>
<charset>UTF-8</charset>
<encoding>UTF-8</encoding>
<docencoding>UTF-8</docencoding>
<locale>en_US</locale>
<failOnWarnings>false</failOnWarnings>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.9.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>ultikits-sonatype</publishingServerId>
<autoPublish>true</autoPublish>
<waitUntil>published</waitUntil>
</configuration>
</plugin>
<plugin>
<groupId>com.ultikits</groupId>
<artifactId>ultitools-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<name>UltiTools-API</name>
<identifyString>UltiTools-API</identifyString>
<shortDescription>UltiTools-API</shortDescription>
<accessKeyFile>access_key.txt</accessKeyFile>
<pluginFolder>${ultitools.deploy.folder}</pluginFolder>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/releases/</url>
</repository>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- <dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency> -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.38</version>
<scope>provided</scope>
</dependency>
<!--
JetBrains @ApiStatus —— 只用来标 API 稳定性边界,是给人和 IDE 看的信号,
不产生任何运行期约束。全系注解都是 RetentionPolicy.CLASS,运行时不需要
这个 jar:所以 scope 用 provided、plugin.yml 的 libraries: 不加条目、
shaded JAR 里也不该出现 org/jetbrains/**。这三件事是一套的,动一个要一起动。
JetBrains @ApiStatus — used only to mark API stability boundaries. It is a
signal for humans and IDEs, and enforces nothing at runtime. Every annotation
in the family is RetentionPolicy.CLASS, so the jar is not needed at runtime:
hence provided scope, no plugin.yml libraries: entry, and no org/jetbrains/**
inside the shaded JAR. Those three facts move together.
-->
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>26.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7.1</version>
<scope>provided</scope>
</dependency>
<!-- JSON 统一使用 Gson - Paper libraries 自动下载 -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<scope>provided</scope>
</dependency>
<!-- fastjson 已迁移到 Gson,不再需要 -->
<!-- commons-dbutils - Paper libraries 自动下载 -->
<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
<version>1.8.1</version>
<scope>provided</scope>
</dependency>
<!-- MySQL Connector - Paper libraries 自动下载 -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.3.0</version>
<scope>provided</scope>
</dependency>
<!--
protobuf-java —— 不是本项目直接用的库,是 mysql-connector-j 的传递依赖。
显式声明只为把版本从 3.25.1 抬到 3.25.5,规避 GHSA-735f-pc8j-v9w8。
provided 作用域与 plugin.yml 的 libraries: 对应(Paper 在运行时下载)。
删掉这一条会静默退回 3.25.1,因为传递解析还在。见 issue #220。
-->
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.25.5</version>
<scope>provided</scope>
</dependency>
<!-- Java-WebSocket - Paper libraries 自动下载 -->
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.5.4</version>
<scope>provided</scope>
</dependency>
<!-- Adventure - Paper 1.16.5+ 原生支持,无需打包 -->
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.hamza-cskn</groupId>
<artifactId>obliviate-invs</artifactId>
<version>${gui.version}</version>
<exclusions>
<!-- 排除重复的 UniversalScheduler (core 和 advancedslot 都包含) -->
<exclusion>
<groupId>com.github.Anon8281</groupId>
<artifactId>UniversalScheduler</artifactId>
</exclusion>
<!-- 排除重复的 version-detection -->
<exclusion>
<groupId>com.github.hamza-cskn.obliviate-utils</groupId>
<artifactId>version-detection</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 单独引入 UniversalScheduler 避免重复 -->
<dependency>
<groupId>com.github.Anon8281</groupId>
<artifactId>UniversalScheduler</artifactId>
<version>0.1.6</version>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.6</version>
<scope>provided</scope>
</dependency>
<!-- XSeries for cross-version compatibility (1.8.8 - 1.21+) -->
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>13.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.zaxxer/HikariCP -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>5.1.0</version>
<scope>provided</scope>
</dependency>
<!-- JUnit 5 dependencies for testing -->
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.10.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockbukkit.mockbukkit</groupId>
<artifactId>mockbukkit-v1.21</artifactId>
<version>4.101.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.27.7</version>
<scope>test</scope>
</dependency>
<!-- H2 Database for integration testing -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.2.224</version>
<scope>test</scope>
</dependency>
<!-- CGLIB for AOP proxy support - Paper libraries 自动下载 -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>3.3.0</version>
<scope>provided</scope>
</dependency>
<!-- JavaMail for email service - Paper libraries 自动下载 -->
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
<!--
发布 profile:GPG 签名只在这里激活,别处一律不签。
只有 Maven Central 需要签名产物,而私钥只存在于发布环境。
把 maven-gpg-plugin 无条件绑在 verify 上,会让任何没有私钥的人
跑 mvn verify 或 mvn install 都失败,CI 也得处处传 gpg.skip 才能绕开。
发布时漏掉 -P release 的后果是产物没有签名、被 Central 的校验直接拒绝,
是一次响亮的失败,而不是静默发出未签名产物。
Release-only profile: GPG signing is activated here and nowhere else.
Only Maven Central needs signed artifacts, and the private key exists
only in the release environment. Binding maven-gpg-plugin to verify
unconditionally breaks mvn verify and mvn install for everyone without
a key. Forgetting -P release fails loudly at Central's validation
instead of silently publishing unsigned artifacts.
-->
<profile>
<id>release</id>
<build>
<plugins>
<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>
</profiles>
</project>