-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathpom.xml
618 lines (535 loc) · 23 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
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
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to you under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<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/maven-v4_0_0.xsd">
<!-- ██ ██ █████ ██████ ███ ██ ██ ███ ██ ██████ ██
██ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██ ██ ██
██ █ ██ ███████ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██
██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███ ███ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██████ ██
`log4j-tools` project modules should use `log4j-tools-parent` as their parents, not this POM!
This POM constitutes the BOM to be imported by applications using `log4j-tools` project modules. -->
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.logging</groupId>
<artifactId>logging-parent</artifactId>
<version>9</version>
</parent>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-tools-bom</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<url>https://github.com/apache/logging-log4j-tools</url>
<inceptionYear>2022</inceptionYear>
<organization>
<name>Apache Software Foundation</name>
<url>https://apache.org</url>
</organization>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>
<developers>
<developer>
<id>pkarwasz</id>
<name>Piotr P. Karwasz</name>
<email>[email protected]</email>
<roles>
<role>PMC Member</role>
</roles>
<timezone>Europe/Warsaw</timezone>
</developer>
<developer>
<id>rgoers</id>
<name>Ralph Goers</name>
<email>[email protected]</email>
<organization>Nextiva</organization>
<roles>
<role>PMC Member</role>
</roles>
<timezone>America/Phoenix</timezone>
</developer>
<developer>
<id>vy</id>
<name>Volkan Yazıcı</name>
<email>[email protected]</email>
<roles>
<role>PMC Member</role>
</roles>
<timezone>Europe/Amsterdam</timezone>
</developer>
</developers>
<modules>
<!-- the parent POM must come first: -->
<module>log4j-tools-parent</module>
<!-- Modules here must have a corresponding entry in `dependencyManagement > dependencies` block below! -->
<module>log4j-changelog</module>
<module>log4j-changelog-maven-plugin</module>
</modules>
<scm>
<connection>scm:git:[email protected]:apache/logging-log4j-tools.git</connection>
<developerConnection>scm:git:[email protected]:apache/logging-log4j-tools.git</developerConnection>
<tag>HEAD</tag>
<url>https://github.com/apache/logging-log4j-tools</url>
</scm>
<issueManagement>
<system>GitHub Issues</system>
<url>https://github.com/apache/logging-log4j-tools/issues</url>
</issueManagement>
<ciManagement>
<system>GitHub Actions</system>
<url>https://github.com/apache/logging-log4j-tools/actions</url>
</ciManagement>
<distributionManagement>
<!-- `repository` from parent `org.apache.logging:logging-parent` (id: `apache.releases.https`) -->
<!-- `snapshotRepository` from parent `org.apache.logging:logging-parent` (id: `apache.snapshots.https`) -->
</distributionManagement>
<properties>
<!-- project version -->
<revision>0.4.0</revision>
<!-- `minimalJavaBuildVersion` is employed by `org.apache:apache`, which is the parent of `org.apache.logging:logging-parent`, which is the parent of us.
`minimalJavaBuildVersion` is used for enforcing the compiler version.
We will use `java.version` to enforce the target JVM byte code, which is 8. -->
<minimalJavaBuildVersion>[17,18)</minimalJavaBuildVersion>
<java.version>8</java.version>
<!-- `project.build.outputTimestamp` is required for reproducible builds: https://maven.apache.org/guides/mini/guide-reproducible-builds.html -->
<project.build.outputTimestamp>0</project.build.outputTimestamp>
<!-- dependency versions -->
<org.eclipse.jgit.version>6.6.0.202305301015-r</org.eclipse.jgit.version>
<!-- plugin versions -->
<beanshell-maven-plugin.version>1.4</beanshell-maven-plugin.version>
<error-prone.version>2.20.0</error-prone.version>
<findsecbugs-plugin.version>1.12.0</findsecbugs-plugin.version>
<flatten-maven-plugin.version>1.5.0</flatten-maven-plugin.version>
<log4j-changelog-maven-plugin.version>0.3.0</log4j-changelog-maven-plugin.version>
<maven-deploy-plugin.version>3.0.0</maven-deploy-plugin.version>
<sign-maven-plugin.version>1.0.1</sign-maven-plugin.version>
<spotbugs-maven-plugin.version>4.7.3.5</spotbugs-maven-plugin.version>
<xml-maven-plugin.version>1.0.2</xml-maven-plugin.version>
</properties>
<!-- `dependencyManagement` must only contain `log4j-tools` modules and nothing else!
Modules here must have a corresponding entry in `modules` block above! -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-changelog</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-changelog-maven-plugin</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>${flatten-maven-plugin.version}</version>
<configuration>
<!-- Setting `outputDirectory` to `project.build.directory`, which is cleaned by `default-clean` execution of `clean:clean`.
This makes `flatten:clean` redundant. -->
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>${maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>${spotbugs-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- BOMs should ideally _only_ contain dependencies for modules of the project.
No invasive properties or plugin/dependency management – either from the BOM itself or its parent.
The following `flatten-maven-plugin` exactly performs that trimming operation. -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>${flatten-maven-plugin.version}</version>
<inherited>false</inherited>
<executions>
<execution>
<id>flatten-bom</id>
<goals>
<goal>flatten</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<flattenMode>bom</flattenMode>
<!-- POM `ElementHandling` is pretty cryptic: https://www.mojohaus.org/flatten-maven-plugin/apidocs/org/codehaus/mojo/flatten/ElementHandling.html
Trial-and-error has shown that we should use either `remove` or `interpolate`.
`remove` simply removes the element.
`interpolate` takes the element from the original POM with variables interpolated.
Avoid using `resolve`, which uses the effective POM where inherited changes from the parent are also incorporated. -->
<pomElements>
<properties>remove</properties>
<repositories>remove</repositories>
<distributionManagement>remove</distributionManagement>
<dependencyManagement>interpolate</dependencyManagement>
</pomElements>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>${java.version}</release>
<encoding>${project.build.sourceEncoding}</encoding>
<compilerArgs>
<arg>-Xlint:all</arg>
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>${error-prone.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<!-- Apache RAT (Release Audit Tool) check to verify licenses.
`apache-rat-plugin`: https://creadur.apache.org/rat/apache-rat-plugin/
Release Audit Tool: https://creadur.apache.org/rat/index.html -->
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<consoleOutput>true</consoleOutput>
<excludes>
<exclude>**/target/**/*</exclude>
<exclude>.java-version</exclude>
<exclude>.mvn/jvm.config</exclude>
<exclude>**/*.txt</exclude>
<!-- IntelliJ IDEA files: -->
<exclude>.idea/**/*</exclude>
<exclude>**/*.iml</exclude>
<!-- License headers in GitHub templates pollute the prompt displayed to the user: -->
<exclude>.github/ISSUE_TEMPLATE/*.md</exclude>
<exclude>.github/pull_request_template.md</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
<!-- Ensure that version for each dependency resolved during a build, is equal to or higher than all transitive dependency declarations.
A failure here requires adding the dependency to the dependency management. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-upper-bound-deps</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireUpperBoundDeps />
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<configuration>
<plugins>
<plugin>
<groupId>com.h3xstream.findsecbugs</groupId>
<artifactId>findsecbugs-plugin</artifactId>
<version>${findsecbugs-plugin.version}</version>
</plugin>
</plugins>
</configuration>
<executions>
<execution>
<id>default-spotbugs</id>
<goals>
<goal>check</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>${xml-maven-plugin.version}</version>
<inherited>false</inherited>
<executions>
<execution>
<goals>
<goal>validate</goal>
</goals>
<configuration>
<validationSets>
<validationSet>
<dir>src/changelog</dir>
<includes>**/*.xml</includes>
<publicId>http://logging.apache.org/log4j/changelog</publicId>
<systemId>https://logging.apache.org/log4j/changelog-0.1.1.xsd</systemId>
<validating>true</validating>
</validationSet>
</validationSets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<!-- `changelog-export` profile to export changelogs.
It is manually enabled by users to generate release notes.
See `RELEASING.adoc` for instructions. -->
<profile>
<id>changelog-export</id>
<build>
<defaultGoal>log4j-changelog:export</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-changelog-maven-plugin</artifactId>
<version>${log4j-changelog-maven-plugin.version}</version>
<inherited>false</inherited>
<configuration>
<outputDirectory>${project.build.directory}/release-notes</outputDirectory>
<indexTemplates>
<template>
<source>.index.md.ftl</source>
</template>
</indexTemplates>
<changelogTemplates>
<template>
<source>.release-notes.md.ftl</source>
<target>%v.md</target>
</template>
</changelogTemplates>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<!-- `changelog-release` profile to move `src/changelog/.0.x.x` contents to their associated release directory.
It is manually enabled by users while cutting a release.
See `RELEASING.adoc` for instructions. -->
<profile>
<id>changelog-release</id>
<build>
<defaultGoal>log4j-changelog:release</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-changelog-maven-plugin</artifactId>
<version>${log4j-changelog-maven-plugin.version}</version>
<inherited>false</inherited>
<configuration>
<releaseVersion>${revision}</releaseVersion>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<!-- `distribution` profile creating the distribution ZIP containing:
1. Git-tracked sources
2. Generated JAR files
3. Release notes
This profile must be executed after a successful `package` phase, since we need JARs.
This profile is manually enabled by `.github/workflows/build.yml` while releasing. -->
<profile>
<id>distribution</id>
<build>
<defaultGoal>log4j-changelog:export bsh:run</defaultGoal>
<plugins>
<!-- Generate release notes -->
<plugin>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-changelog-maven-plugin</artifactId>
<version>${log4j-changelog-maven-plugin.version}</version>
<configuration>
<outputDirectory>${project.build.directory}/release-notes</outputDirectory>
<indexTemplates>
<template>
<source>.index.md.ftl</source>
</template>
</indexTemplates>
<changelogTemplates>
<template>
<source>.release-notes.md.ftl</source>
<target>%v.md</target>
</template>
</changelogTemplates>
</configuration>
</plugin>
<!-- Create the distribution ZIP -->
<plugin>
<groupId>com.github.genthaler</groupId>
<artifactId>beanshell-maven-plugin</artifactId>
<version>${beanshell-maven-plugin.version}</version>
<configuration>
<script><![CDATA[import java.io.*;
import java.nio.file.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
import java.util.zip.*;
import org.eclipse.jgit.dircache.*;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
zip(String zipFileName, Map pathByFile) {
OutputStream outputStream = new FileOutputStream(zipFileName);
ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream);
try {
for (String file : pathByFile.keySet()) {
Path path = pathByFile.get(file);
ZipEntry zipEntry = new ZipEntry(file);
zipEntry.setTime(0);
zipOutputStream.putNextEntry(zipEntry);
zipOutputStream.write(Files.readAllBytes(path));
zipOutputStream.closeEntry();
}
} finally {
zipOutputStream.close();
}
}
// Find Git-tracked files
SortedMap pathByFile = new TreeMap();
Repository repo = new FileRepositoryBuilder().readEnvironment().findGitDir().build();
DirCache repoCache = repo.readDirCache();
String repoDirectoryParent = repo.getDirectory().getParent();
for (int repoCacheEntryIndex = 0; repoCacheEntryIndex < repoCache.getEntryCount(); repoCacheEntryIndex++) {
DirCacheEntry repoCacheEntry = repoCache.getEntry(repoCacheEntryIndex);
String repoCacheEntryPath = repoCacheEntry.getPathString();
pathByFile.put(repoCacheEntryPath, new File(repoDirectoryParent, repoCacheEntryPath).toPath());
}
// Create `src.zip` using Git-tracked files
zip("target/src.zip", pathByFile);
System.out.format("Generated source ZIP containing %d files.%n", new Object[]{pathByFile.size()});
// Find auxiliary files that will go into the distribution
SortedMap pathByFile = new TreeMap();
pathByFile.put("src.zip", new File("target/src.zip").toPath());
pathByFile.put("RELEASE-NOTES.md", new File("target/release-notes/${revision}.md").toPath());
pathByFile.put("NOTICE.txt", new File("NOTICE.txt").toPath());
pathByFile.put("LICENSE.txt", new File("LICENSE.txt").toPath());
// Find JAR files that will go into the distribution
Stream paths = Files.walk(new File(repoDirectoryParent).toPath(), 8, new FileVisitOption[0]);
int[] jarCount = {0};
try {
paths.forEach(new Consumer() {
public void accept(Path path) {
File file = path.toFile();
if (file.getParentFile().getName().equals("target") &&
file.getName().matches("^log4j-(.+)-${revision}(-tests)?\\.jar$")) {
pathByFile.put(file.getName(), path);
jarCount[0]++;
}
}
});
} finally {
paths.close();
}
// Check if no JARs are found
if (jarCount[0] == 0) {
System.err.println("Error: Could not find any JARs!");
System.err.println("Tip: Have you already executed the Maven `package` goal?");
System.exit(1);
}
// Create the distribution ZIP
zip("target/dist.zip", pathByFile);
System.out.format("Generated distribution ZIP containing following %d files:%n", new Object[] {pathByFile.size()});
for (String file : pathByFile.keySet()) {
System.out.println("-> " + file);
}]]></script>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>${org.eclipse.jgit.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<!-- `deploy` profile activating deployment-specific configuration.
It is manually enabled by `.github/workflows/build.yml` while releasing. -->
<profile>
<id>deploy</id>
<properties>
<deployAtEnd>true</deployAtEnd>
<installAtEnd>true</installAtEnd>
<skipTests>true</skipTests>
<spotbugs.skip>true</spotbugs.skip>
<spotless.check.skip>true</spotless.check.skip>
</properties>
<build>
<defaultGoal>deploy</defaultGoal>
<plugins>
<plugin>
<groupId>org.simplify4u.plugins</groupId>
<artifactId>sign-maven-plugin</artifactId>
<version>${sign-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>