| <?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/xsd/maven-4.0.0.xsd"> |
| |
| <modelVersion>4.0.0</modelVersion> |
| |
| <!-- `org.apache:apache` parent provides the following top level metadata that we don't need to override: |
| - `license` |
| - `organization` |
| - `repositories |
| - `distributionManagement` --> |
| <parent> |
| <groupId>org.apache</groupId> |
| <artifactId>apache</artifactId> |
| <version>32</version> |
| </parent> |
| |
| <groupId>org.apache.logging</groupId> |
| <artifactId>logging-parent</artifactId> |
| <version>${revision}</version> |
| <packaging>pom</packaging> |
| |
| <name>Apache Logging Parent</name> |
| <!-- `description` should ideally match the entry in `.asf.yaml` --> |
| <description>Parent project internally used in Maven-based projects of the Apache Logging Services</description> |
| |
| <url>https://logging.apache.org/logging-parent</url> |
| |
| <inceptionYear>1999</inceptionYear> |
| |
| <developers> |
| |
| <developer> |
| <id>ggregory</id> |
| <name>Gary Gregory</name> |
| <email>ggregory@apache.org</email> |
| <url>https://www.garygregory.com</url> |
| <organization>The Apache Software Foundation</organization> |
| <organizationUrl>https://www.apache.org/</organizationUrl> |
| <roles> |
| <role>PMC Member</role> |
| </roles> |
| <timezone>America/New_York</timezone> |
| </developer> |
| |
| <developer> |
| <id>grobmeier</id> |
| <name>Christian Grobmeier</name> |
| <email>grobmeier@apache.org</email> |
| <roles> |
| <role>PMC Member</role> |
| </roles> |
| <timezone>Europe/Berlin</timezone> |
| </developer> |
| |
| <developer> |
| <id>mattsicker</id> |
| <name>Matt Sicker</name> |
| <email>mattsicker@apache.org</email> |
| <organization>Apple</organization> |
| <roles> |
| <role>PMC Member</role> |
| </roles> |
| <timezone>America/Chicago</timezone> |
| </developer> |
| |
| <developer> |
| <id>pkarwasz</id> |
| <name>Piotr P. Karwasz</name> |
| <email>pkarwasz@apache.org</email> |
| <roles> |
| <role>PMC Member</role> |
| </roles> |
| <timezone>Europe/Warsaw</timezone> |
| </developer> |
| |
| <developer> |
| <id>vy</id> |
| <name>Volkan Yazıcı</name> |
| <email>vy@apache.org</email> |
| <roles> |
| <role>PMC Chair</role> |
| </roles> |
| <timezone>Europe/Amsterdam</timezone> |
| </developer> |
| |
| </developers> |
| |
| <mailingLists> |
| |
| <mailingList> |
| <name>log4j-user</name> |
| <subscribe>log4j-user-subscribe@logging.apache.org</subscribe> |
| <unsubscribe>log4j-user-unsubscribe@logging.apache.org</unsubscribe> |
| <post>log4j-user@logging.apache.org</post> |
| <archive>https://lists.apache.org/list.html?log4j-user@logging.apache.org</archive> |
| </mailingList> |
| |
| <mailingList> |
| <name>dev</name> |
| <subscribe>dev-subscribe@logging.apache.org</subscribe> |
| <unsubscribe>dev-unsubscribe@logging.apache.org</unsubscribe> |
| <post>dev@logging.apache.org</post> |
| <archive>https://lists.apache.org/list.html?dev@logging.apache.org</archive> |
| </mailingList> |
| |
| </mailingLists> |
| |
| <scm> |
| <connection>scm:git:git@github.com:apache/logging-parent.git</connection> |
| <developerConnection>scm:git:git@github.com:apache/logging-parent.git</developerConnection> |
| <tag>HEAD</tag> |
| <url>https://github.com/apache/logging-parent</url> |
| </scm> |
| |
| <issueManagement> |
| <system>GitHub Issues</system> |
| <url>https://github.com/apache/logging-parent/issues</url> |
| </issueManagement> |
| |
| <ciManagement> |
| <system>GitHub Actions</system> |
| <url>https://github.com/apache/logging-parent/actions</url> |
| </ciManagement> |
| |
| <distributionManagement> |
| <downloadUrl>https://logging.apache.org/download.html</downloadUrl> |
| </distributionManagement> |
| |
| <properties> |
| |
| <!-- project version --> |
| <revision>11.2.0-SNAPSHOT</revision> |
| |
| <!-- `project.build.outputTimestamp` is required to be present for reproducible builds. |
| We actually inherit one from the `org.apache:apache` parent. |
| Though inheriting this property has two undesired consequences: |
| 1. `artifact:compare` dumps an `ERROR` log stating that this `property should not be inherited but defined` (#50) |
| 2. This value is employed in various places while creating the distribution |
| To mitigate these, we define a *dummy* value here and let the CI replace it during a release. |
| Hence, *DO NOT MANUALLY EDIT THIS VALUE*! --> |
| <project.build.outputTimestamp>2024-05-15T13:12:38Z</project.build.outputTimestamp> |
| |
| <!-- target Java 8 --> |
| <maven.compiler.source>8</maven.compiler.source> |
| <maven.compiler.target>8</maven.compiler.target> |
| <maven.compiler.release>8</maven.compiler.release> |
| |
| <!-- `minimalJavaBuildVersion` is employed by `org.apache:apache`, which is the parent of us. |
| `minimalJavaBuildVersion` is used for enforcing the compiler version. --> |
| <minimalJavaBuildVersion>[17,18)</minimalJavaBuildVersion> |
| |
| <!-- `bnd-maven-plugin` 7.x requires a Maven version `3.8.1` or higher --> |
| <minimalMavenBuildVersion>3.8.1</minimalMavenBuildVersion> |
| |
| <!-- JPMS and OSGi options --> |
| <!-- Overrides some options in multi-release JARs --> |
| <bnd-multi-release>false</bnd-multi-release> |
| <!-- Module name: defaults to the OSGi symbolic bundle name --> |
| <bnd-module-name>$[Bundle-SymbolicName]</bnd-module-name> |
| <!-- |
| ~ Allows to change imported package attributes (e.g. add 'resolution:=optional') |
| ~ See: https://bnd.bndtools.org/heads/import_package.html |
| --> |
| <bnd-extra-package-options /> |
| <!-- |
| ~ Allows to override the compute JPMS 'requires' statements. |
| ~ This should be used only if the previous `bnd-extra-package-options` can not be used |
| ~ due to a (reported?) BND bug. |
| ~ See: https://bnd.bndtools.org/chapters/330-jpms.html#advanced-options |
| --> |
| <bnd-extra-module-options /> |
| <!-- Allows to extend the `bnd-maven-plugin` configuration with extras: --> |
| <bnd-extra-config /> |
| |
| <!-- |
| ~ These properties allow to override the default `bnd-maven-plugin` configuration through properties. |
| ~ They should be used as a last resort. |
| --> |
| <!-- |
| ~ Create OSGi and JPMS module names based on the `groupId` and `artifactId`. |
| ~ This almost agrees with `maven-bundle-plugin`, but replaces non-alphanumeric characters |
| ~ with full stops `.`. |
| --> |
| <bnd-bundle-symbolicname>$[project.groupId].$[subst;$[subst;$[project.artifactId];log4j-];[^A-Za-z0-9];.]</bnd-bundle-symbolicname> |
| <bnd-jpms-module-info>$[bnd-module-name];access=0</bnd-jpms-module-info> |
| |
| <!-- VDR coordinates --> |
| <vdr.url>https://logging.apache.org/cyclonedx/vdr.xml</vdr.url> |
| |
| <!-- dependency versions --> |
| <org.eclipse.jgit.version>6.9.0.202403050737-r</org.eclipse.jgit.version> |
| <!-- These are annotation with a retention of CLASS. They can be freely upgraded. --> |
| <bnd.annotation.version>7.0.0</bnd.annotation.version> |
| <jspecify.version>0.3.0</jspecify.version> |
| <node.version>21.7.1</node.version> |
| <npm.version>10.5.0</npm.version> |
| <osgi.annotation.version>8.1.0</osgi.annotation.version> |
| <osgi.annotation.bundle.version>2.0.0</osgi.annotation.bundle.version> |
| <osgi.annotation.versioning.version>1.1.2</osgi.annotation.versioning.version> |
| <palantir-java-format.version>2.46.0</palantir-java-format.version> |
| <spotbugs-annotations.version>4.8.5</spotbugs-annotations.version> |
| |
| <!-- plugin versions --> |
| <asciidoctor-maven-plugin.version>3.0.0</asciidoctor-maven-plugin.version> |
| <beanshell-maven-plugin.version>1.4</beanshell-maven-plugin.version> |
| <bnd-maven-plugin.version>7.0.0</bnd-maven-plugin.version> |
| <bnd-baseline-maven-plugin.version>7.0.0</bnd-baseline-maven-plugin.version> |
| <build-helper-maven-plugin.version>3.6.0</build-helper-maven-plugin.version> |
| <common-custom-user-data-maven-extension.version>2.0</common-custom-user-data-maven-extension.version> |
| <cyclonedx-maven-plugin.version>2.8.0</cyclonedx-maven-plugin.version> |
| <develocity-maven-plugin.version>1.21.5</develocity-maven-plugin.version> |
| <exec-maven-plugin.version>3.3.0</exec-maven-plugin.version> |
| <flatten-maven-plugin.version>1.6.0</flatten-maven-plugin.version> |
| <frontend-maven-plugin.version>1.15.0</frontend-maven-plugin.version> |
| <jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version> |
| <log4j-changelog-maven-plugin.version>0.9.0</log4j-changelog-maven-plugin.version> |
| <maven-artifact-plugin.version>3.5.1</maven-artifact-plugin.version> |
| <restrict-imports-enforcer-rule.version>2.5.0</restrict-imports-enforcer-rule.version> |
| <sign-maven-plugin.version>1.1.0</sign-maven-plugin.version> |
| <spotbugs-maven-plugin.version>4.8.5.0</spotbugs-maven-plugin.version> |
| <spotless-maven-plugin.version>2.43.0</spotless-maven-plugin.version> |
| <xml-maven-plugin.version>1.1.0</xml-maven-plugin.version> |
| |
| <!-- plugin dependencies versions --> |
| <error-prone.version>2.28.0</error-prone.version> |
| <!-- `findsecbugs-plugin:1.13.0` contains a bug blocking Log4j compilation: https://github.com/find-sec-bugs/find-sec-bugs/pull/728 |
| Hence, pinning the `1.12.0` instead. --> |
| <findsecbugs-plugin.version>1.13.0</findsecbugs-plugin.version> |
| |
| <!-- site-specific versions --> |
| <!-- We use a separate property than `project.version` to refer to the most recent _published_ version of the project. |
| This will be used in the site and updated automatically by `dependabot`. --> |
| <site-project.version>11.0.0</site-project.version> |
| |
| </properties> |
| |
| <dependencyManagement> |
| <dependencies> |
| |
| <!-- Dummy dependency to trick `dependabot` into updating the `site-project.version` property --> |
| <dependency> |
| <groupId>org.apache.logging</groupId> |
| <artifactId>logging-parent</artifactId> |
| <version>${site-project.version}</version> |
| <type>pom</type> |
| </dependency> |
| |
| <dependency> |
| <groupId>biz.aQute.bnd</groupId> |
| <artifactId>biz.aQute.bnd.annotation</artifactId> |
| <version>${bnd.annotation.version}</version> |
| </dependency> |
| |
| <dependency> |
| <groupId>com.github.spotbugs</groupId> |
| <artifactId>spotbugs-annotations</artifactId> |
| <version>${spotbugs-annotations.version}</version> |
| </dependency> |
| |
| <dependency> |
| <groupId>org.jspecify</groupId> |
| <artifactId>jspecify</artifactId> |
| <version>${jspecify.version}</version> |
| </dependency> |
| |
| <dependency> |
| <groupId>org.osgi</groupId> |
| <artifactId>osgi.annotation</artifactId> |
| <version>${osgi.annotation.version}</version> |
| </dependency> |
| |
| <dependency> |
| <groupId>org.osgi</groupId> |
| <artifactId>org.osgi.annotation.bundle</artifactId> |
| <version>${osgi.annotation.bundle.version}</version> |
| </dependency> |
| |
| <dependency> |
| <groupId>org.osgi</groupId> |
| <artifactId>org.osgi.annotation.versioning</artifactId> |
| <version>${osgi.annotation.versioning.version}</version> |
| </dependency> |
| </dependencies> |
| </dependencyManagement> |
| |
| <build> |
| |
| <pluginManagement> |
| |
| <!-- Managed plugins ordered alphabetically by `artifactId` --> |
| <plugins> |
| |
| <plugin> |
| <groupId>org.asciidoctor</groupId> |
| <artifactId>asciidoctor-maven-plugin</artifactId> |
| <version>${asciidoctor-maven-plugin.version}</version> |
| </plugin> |
| |
| <plugin> |
| <groupId>com.github.genthaler</groupId> |
| <artifactId>beanshell-maven-plugin</artifactId> |
| <version>${beanshell-maven-plugin.version}</version> |
| </plugin> |
| |
| <plugin> |
| <groupId>biz.aQute.bnd</groupId> |
| <artifactId>bnd-baseline-maven-plugin</artifactId> |
| <version>${bnd-baseline-maven-plugin.version}</version> |
| </plugin> |
| |
| <plugin> |
| <groupId>biz.aQute.bnd</groupId> |
| <artifactId>bnd-maven-plugin</artifactId> |
| <version>${bnd-maven-plugin.version}</version> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.codehaus.mojo</groupId> |
| <artifactId>build-helper-maven-plugin</artifactId> |
| <version>${build-helper-maven-plugin.version}</version> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.cyclonedx</groupId> |
| <artifactId>cyclonedx-maven-plugin</artifactId> |
| <version>${cyclonedx-maven-plugin.version}</version> |
| </plugin> |
| |
| <!-- Fake entry to be upgraded by Dependabot --> |
| <plugin> |
| <groupId>com.gradle</groupId> |
| <artifactId>develocity-maven-plugin</artifactId> |
| <version>${develocity-maven-plugin.version}</version> |
| </plugin> |
| |
| <!-- Fake entry to be upgraded by Dependabot --> |
| <plugin> |
| <groupId>com.gradle</groupId> |
| <artifactId>common-custom-user-data-maven-extension</artifactId> |
| <version>${common-custom-user-data-maven-extension.version}</version> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.codehaus.mojo</groupId> |
| <artifactId>flatten-maven-plugin</artifactId> |
| <version>${flatten-maven-plugin.version}</version> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.jacoco</groupId> |
| <artifactId>jacoco-maven-plugin</artifactId> |
| <version>${jacoco-maven-plugin.version}</version> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.apache.logging.log4j</groupId> |
| <artifactId>log4j-changelog-maven-plugin</artifactId> |
| <version>${log4j-changelog-maven-plugin.version}</version> |
| </plugin> |
| |
| <!-- `artifact:compare` is used in `.github/workflows/build-reusable.yaml` --> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-artifact-plugin</artifactId> |
| <version>${maven-artifact-plugin.version}</version> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.simplify4u.plugins</groupId> |
| <artifactId>sign-maven-plugin</artifactId> |
| <version>${sign-maven-plugin.version}</version> |
| </plugin> |
| |
| <plugin> |
| <groupId>com.github.spotbugs</groupId> |
| <artifactId>spotbugs-maven-plugin</artifactId> |
| <version>${spotbugs-maven-plugin.version}</version> |
| </plugin> |
| |
| <plugin> |
| <groupId>com.diffplug.spotless</groupId> |
| <artifactId>spotless-maven-plugin</artifactId> |
| <version>${spotless-maven-plugin.version}</version> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.codehaus.mojo</groupId> |
| <artifactId>xml-maven-plugin</artifactId> |
| <version>${xml-maven-plugin.version}</version> |
| </plugin> |
| |
| </plugins> |
| |
| </pluginManagement> |
| |
| <plugins> |
| |
| <plugin> |
| <groupId>org.codehaus.mojo</groupId> |
| <artifactId>flatten-maven-plugin</artifactId> |
| <executions> |
| |
| <!-- Resolves `revision` property prior to deployment. |
| Skipping this step would result in artifacts not consumable by Maven. |
| https://maven.apache.org/maven-ci-friendly.html#install-deploy --> |
| <execution> |
| <id>flatten-revision</id> |
| <goals> |
| <goal>flatten</goal> |
| </goals> |
| <phase>process-resources</phase> |
| <configuration> |
| <updatePomFile>true</updatePomFile> |
| <flattenMode>resolveCiFriendliesOnly</flattenMode> |
| </configuration> |
| </execution> |
| |
| <!-- Cleans the `.flattened-pom.xml` files --> |
| <execution> |
| <id>clean-flattened-pom</id> |
| <goals> |
| <goal>clean</goal> |
| </goals> |
| <phase>clean</phase> |
| </execution> |
| |
| <!-- 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. --> |
| <execution> |
| <id>flatten-bom</id> |
| <goals> |
| <goal>flatten</goal> |
| </goals> |
| <!-- BOM flattening is disabled by default! |
| This execution must be manually enabled by the consumer. --> |
| <phase>none</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> |
| <build>remove</build> |
| <properties>remove</properties> |
| <repositories>remove</repositories> |
| <distributionManagement>remove</distributionManagement> |
| <dependencyManagement>interpolate</dependencyManagement> |
| <!-- Keep the `parent`! |
| Otherwise, this causes build failures for artifacts whose dependencies need to be resolved at runtime. |
| Consider the following problem experienced in `log4j-transform-maven-plugin`: |
| |
| 1. `log4j-transform-parent` depends on `log4j-transform-bom` |
| 2. `log4j-transform-bom` depends on `logging-parent` |
| 3. `logging-parent` contains `dependencyManagement`, etc. that are used by `log4j-transform-maven-plugin` |
| 4. Dependencies of `log4j-transform-maven-plugin` et al. is resolved *at runtime* |
| 5. Though at runtime, the deployed `log4j-transform-bom` is used, which is flattened and hence doesn't have a parent! |
| 6. Hence, at runtime, all `logging-parent` logic is lost |
| |
| To avoid this, parents should better be kept while flattening BOMs. --> |
| <parent>keep</parent> |
| </pomElements> |
| </configuration> |
| </execution> |
| |
| </executions> |
| </plugin> |
| |
| <!-- |
| ~ Removes existing `module-info.class` before each compilation to prevent `javac` failures. |
| ~ See https://github.com/copernik-eu/bug-reproducibility/tree/main/javac-module-info-bug |
| --> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-clean-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>delete-module-descriptor</id> |
| <goals> |
| <goal>clean</goal> |
| </goals> |
| <phase>process-resources</phase> |
| <configuration> |
| <excludeDefaultDirectories>true</excludeDefaultDirectories> |
| <filesets> |
| <fileset> |
| <directory>${project.build.outputDirectory}</directory> |
| <includes> |
| <include>module-info.class</include> |
| </includes> |
| </fileset> |
| </filesets> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-compiler-plugin</artifactId> |
| <configuration> |
| <source>${maven.compiler.source}</source> |
| <release>${maven.compiler.release}</release> |
| <target>${maven.compiler.target}</target> |
| <encoding>${project.build.sourceEncoding}</encoding> |
| <parameters>true</parameters> |
| <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> |
| <executions> |
| <execution> |
| <id>default-testCompile</id> |
| <configuration> |
| <!-- `src/test` and `src/main` might share packages causing `package exists in another module` failures. |
| Hence, use class path instead of module path while compiling tests. --> |
| <useModulePath>false</useModulePath> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-failsafe-plugin</artifactId> |
| <configuration> |
| <!-- Using module path while running tests causes `IllegalAccess` exceptions. |
| We relax that constraint for tests and use class path there. --> |
| <useModulePath>false</useModulePath> |
| </configuration> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-surefire-plugin</artifactId> |
| <configuration> |
| <!-- Using module path while running tests causes `IllegalAccess` exceptions. |
| We relax that constraint for tests and use class path there. --> |
| <useModulePath>false</useModulePath> |
| </configuration> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.cyclonedx</groupId> |
| <artifactId>cyclonedx-maven-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>generate-sbom</id> |
| <goals> |
| <goal>makeAggregateBom</goal> |
| </goals> |
| <phase>package</phase> |
| <configuration> |
| <externalReferences> |
| <externalReference> |
| <type>vulnerability-assertion</type> |
| <url>${vdr.url}</url> |
| </externalReference> |
| </externalReferences> |
| <outputFormat>xml</outputFormat> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-enforcer-plugin</artifactId> |
| <dependencies> |
| <dependency> |
| <groupId>de.skuzzle.enforcer</groupId> |
| <artifactId>restrict-imports-enforcer-rule</artifactId> |
| <version>${restrict-imports-enforcer-rule.version}</version> |
| </dependency> |
| </dependencies> |
| <executions> |
| |
| <!-- |
| ~ 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. |
| --> |
| <execution> |
| <id>enforce-upper-bound-deps</id> |
| <goals> |
| <goal>enforce</goal> |
| </goals> |
| <configuration> |
| <rules> |
| <requireUpperBoundDeps /> |
| </rules> |
| </configuration> |
| </execution> |
| |
| <!-- |
| ~ Ensures that no wildcard imports are used. |
| ~ Wildcard imports increase the differences between branches and can not be expanded through simple tools. |
| --> |
| <execution> |
| <id>ban-wildcard-imports</id> |
| <goals> |
| <goal>enforce</goal> |
| </goals> |
| <configuration> |
| <rules> |
| <RestrictImports> |
| <reason>Expand all wildcard imports</reason> |
| <bannedImport>**.'*'</bannedImport> |
| </RestrictImports> |
| </rules> |
| </configuration> |
| </execution> |
| |
| </executions> |
| </plugin> |
| |
| <plugin> |
| <groupId>com.github.spotbugs</groupId> |
| <artifactId>spotbugs-maven-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>default-spotbugs</id> |
| <goals> |
| <goal>check</goal> |
| </goals> |
| <phase>verify</phase> |
| <configuration> |
| <fork>false</fork> |
| <plugins> |
| <plugin> |
| <groupId>com.h3xstream.findsecbugs</groupId> |
| <artifactId>findsecbugs-plugin</artifactId> |
| <version>${findsecbugs-plugin.version}</version> |
| </plugin> |
| </plugins> |
| </configuration> |
| </execution> |
| </executions> |
| </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 combine.children="append"> |
| <exclude>.java-version</exclude> |
| <exclude>.mvn/jvm.config</exclude> |
| <exclude>**/*.txt</exclude> |
| <!-- The license header in changelog entry files causing Git to match irrelevant files. |
| This is eventually causing merge conflicts. |
| Hence, we avoid enforcing license headers there. --> |
| <exclude>src/changelog/**/*.xml</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> |
| |
| <!-- Configuration here must match the one in `.editorconfig`! --> |
| <plugin> |
| <groupId>com.diffplug.spotless</groupId> |
| <artifactId>spotless-maven-plugin</artifactId> |
| <configuration> |
| <java> |
| <licenseHeader> |
| <!-- https://www.apache.org/legal/src-headers.html#headers --> |
| <content>/* |
| * 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. |
| */</content> |
| </licenseHeader> |
| <palantirJavaFormat> |
| <version>${palantir-java-format.version}</version> |
| </palantirJavaFormat> |
| </java> |
| <pom> |
| <licenseHeader> |
| <!-- https://www.apache.org/legal/src-headers.html#headers --> |
| <content><?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. |
| --></content> |
| <delimiter><project</delimiter> |
| </licenseHeader> |
| <sortPom> |
| <expandEmptyElements>false</expandEmptyElements> |
| <!-- Maven Release plugin uses this style --> |
| <spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement> |
| </sortPom> |
| </pom> |
| <formats> |
| <format> |
| <includes> |
| <include>src/**/*.xml</include> |
| </includes> |
| <excludes> |
| <!-- The license header in changelog entry files causing Git to match irrelevant files. |
| This is eventually causing merge conflicts. |
| Hence, we avoid enforcing license headers there. --> |
| <exclude>src/changelog/**/*.xml</exclude> |
| </excludes> |
| <licenseHeader> |
| <!-- https://www.apache.org/legal/src-headers.html#headers --> |
| <content><?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. |
| --></content> |
| <delimiter><(!DOCTYPE|\w)</delimiter> |
| </licenseHeader> |
| <endWithNewline /> |
| <trimTrailingWhitespace /> |
| </format> |
| <format> |
| <includes> |
| <include>src/**/*.properties</include> |
| </includes> |
| <licenseHeader> |
| <!-- https://www.apache.org/legal/src-headers.html#headers --> |
| <content># |
| # 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. |
| #</content> |
| <delimiter>(##|[^#])</delimiter> |
| </licenseHeader> |
| <endWithNewline /> |
| </format> |
| </formats> |
| <yaml> |
| <includes> |
| <include>.asf.yaml</include> |
| <include>.github/**/*.yaml</include> |
| <include>.github/**/*.yml</include> |
| <include>src/**/*.yaml</include> |
| <include>src/**/*.yml</include> |
| </includes> |
| <licenseHeader> |
| <!-- https://www.apache.org/legal/src-headers.html#headers --> |
| <content># |
| # 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. |
| #</content> |
| <delimiter>(##|[^#])</delimiter> |
| </licenseHeader> |
| <endWithNewline /> |
| <trimTrailingWhitespace /> |
| </yaml> |
| <lineEndings>UNIX</lineEndings> |
| </configuration> |
| <dependencies> |
| <!-- `com.palantir.javaformat:palantir-java-format` is a fake dependency to receive updates from `dependabot`, `maven-versions-plugin`, etc. |
| This dependency is not needed to be defined here, it is implied by `<palantirJavaFormat>` element above. --> |
| <dependency> |
| <groupId>com.palantir.javaformat</groupId> |
| <artifactId>palantir-java-format</artifactId> |
| <version>${palantir-java-format.version}</version> |
| </dependency> |
| </dependencies> |
| <executions> |
| <execution> |
| <id>default-spotless</id> |
| <goals> |
| <goal>check</goal> |
| </goals> |
| <phase>verify</phase> |
| </execution> |
| </executions> |
| </plugin> |
| |
| <!-- populate the `parsedVersion` property --> |
| <plugin> |
| <groupId>org.codehaus.mojo</groupId> |
| <artifactId>build-helper-maven-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>parse-version</id> |
| <goals> |
| <goal>parse-version</goal> |
| </goals> |
| <phase>validate</phase> |
| </execution> |
| </executions> |
| </plugin> |
| |
| <!-- |
| ~ Generate OSGi and JPMS descriptors. |
| ~ Annotate packages that need to be exported with `org.osgi.annotation.bundle.Export` |
| ~ provided by `org.osgi:org.osgi.annotation.bundle` artifact. |
| --> |
| <plugin> |
| <groupId>biz.aQute.bnd</groupId> |
| <artifactId>bnd-maven-plugin</artifactId> |
| <!-- Common configuration that can be used with all the plugin's goals --> |
| <configuration> |
| <bnd><![CDATA[ |
| # `Bundle-DocURL` uses `project.url`. |
| # This is set to `${project.parent.url}${project.artifactId}` through Maven's inheritance assembly[1]. |
| # This eventually produces incorrect values. |
| # Hence, we remove them from the produced descriptor. |
| # |
| # `Bundle-SCM` uses `project.scm.url` and suffers from the same inheritance problem `Bundle-DocURL` has. |
| # |
| # [1] https://maven.apache.org/ref/3.9.4/maven-model-builder/#inheritance-assembly |
| # Inheritance assembly can be disabled for certain properties, e.g., `project.url`. |
| # Though this would necessitate changes in the root `pom.xml`s of parented projects. |
| # |
| # `Bundle-Developers` is removed, since it is nothing but noise and occupies quite some real estate. |
| -removeheaders: Bundle-DocURL,Bundle-SCM,Bundle-Developers |
| |
| # Create OSGi and JPMS module names based on the `groupId` and `artifactId`. |
| # This almost agrees with `maven-bundle-plugin`, but replaces non-alphanumeric characters |
| # with full stops `.`. |
| Bundle-SymbolicName: $[bnd-bundle-symbolicname] |
| -jpms-module-info: $[bnd-jpms-module-info] |
| |
| # Prevents an execution error in multi-release jars: |
| -fixupmessages.classes_in_wrong_dir: "Classes found in the wrong directory";restrict:=error;is:=warning |
| |
| # Convert API leakage warnings to errors |
| -fixupmessages.priv_refs: "private references";restrict:=warning;is:=error |
| |
| # 1. OSGI modules do not make sense in JPMS |
| # 2. BND has a problem detecting the name of multi-release JPMS modules |
| -jpms-module-info-options: \ |
| $[bnd-extra-module-options],\ |
| org.osgi.core;static=true;transitive=false,\ |
| org.osgi.framework;static=true;transitive=false,\ |
| org.apache.logging.log4j;substitute="log4j-api",\ |
| org.apache.logging.log4j.core;substitute="log4j-core" |
| |
| # Import all packages by default: |
| Import-Package: \ |
| $[bnd-extra-package-options],\ |
| * |
| |
| # Allow each project to override the `Multi-Release` header: |
| Multi-Release: $[bnd-multi-release] |
| |
| # Skipping to set `-jpms-multi-release` to `bnd-multi-release`. |
| # This would generate descriptors in `META-INF/versions/<version>` directories needed for MRJs. |
| # Though we decided to skip it due to following reasons: |
| # 1. It is only needed by a handful of files in `-java9`-suffixed modules of `logging-log4j2`. |
| # Hence, it is effectively insignificant. |
| # 2. `dependency:unpack` and `bnd:bnd-process` executions must be aligned correctly. |
| # See this issue for details: https://github.com/apache/logging-parent/issues/93 |
| # Adds certain `Implementation-*` and `Specification-*` entries to the generated `MANIFEST.MF`. |
| # Using these properties is known to be a bad practice: https://github.com/apache/logging-log4j2/issues/1923#issuecomment-1786818254 |
| # Users should use `META-INF/maven/<groupId>/<artifactId>/pom.properties` instead. |
| # Yet we support it due to backward compatibility reasons. |
| # The issue was reported to `bnd-maven-plugin` too: https://github.com/bndtools/bnd/issues/5855 |
| # We set these values to their Maven Archiver defaults: https://maven.apache.org/shared/maven-archiver/#class_manifest |
| Implementation-Title: ${project.name} |
| Implementation-Vendor: ${project.organization.name} |
| Implementation-Version: ${project.version} |
| Specification-Title: ${project.name} |
| Specification-Vendor: ${project.organization.name} |
| Specification-Version: ${parsedVersion.majorVersion}.${parsedVersion.minorVersion} |
| |
| # Extra configuration provided by the consumer: |
| ${bnd-extra-config} |
| ]]></bnd> |
| </configuration> |
| <executions> |
| <execution> |
| <id>generate-module-descriptors</id> |
| <goals> |
| <!-- `bnd-process` requires `maven-jar-plugin` tweaking! |
| Hence, if you change this goal, make sure to adapt the associated `maven-jar-plugin` configuration too! --> |
| <goal>bnd-process</goal> |
| </goals> |
| </execution> |
| </executions> |
| </plugin> |
| |
| <!-- Configure `maven-jar-plugin` to take `MANIFEST.MF` generated by `bnd:bnd-process` into account. |
| For more information, see: https://github.com/bndtools/bnd/blob/master/maven-plugins/bnd-maven-plugin/README.md#important-note-about-maven-jarwar-plugin --> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-jar-plugin</artifactId> |
| <configuration> |
| <archive> |
| <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> |
| </archive> |
| </configuration> |
| </plugin> |
| |
| <!-- |
| ~ Check for breaking API changes between releases. |
| ~ If a change in the public API occurred, suggests the minimal version number to use. |
| ~ Versioning can be also applied on a per-package level. For this purpose you can |
| ~ annotate packages with `org.osgi.annotation.versioning.Version` provided by `org.osgi:org.osgi.annotation.versioning` artifact. |
| --> |
| <plugin> |
| <groupId>biz.aQute.bnd</groupId> |
| <artifactId>bnd-baseline-maven-plugin</artifactId> |
| <configuration> |
| <!-- Do not use the <distributionManagement&rt; element to download releases --> |
| <includeDistributionManagement>false</includeDistributionManagement> |
| <!-- Do not check against alpha releases --> |
| <releaseversions>true</releaseversions> |
| </configuration> |
| <executions> |
| <execution> |
| <id>check-api-compat</id> |
| <goals> |
| <goal>baseline</goal> |
| </goals> |
| </execution> |
| </executions> |
| </plugin> |
| |
| </plugins> |
| |
| </build> |
| |
| <profiles> |
| |
| <!-- `changelog-validate` profile to validate changelog XMLs --> |
| <profile> |
| |
| <id>changelog-validate</id> |
| |
| <activation> |
| <file> |
| <exists>src/changelog</exists> |
| </file> |
| </activation> |
| |
| <build> |
| <plugins> |
| <plugin> |
| <groupId>org.codehaus.mojo</groupId> |
| <artifactId>xml-maven-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>validate-changelog</id> |
| <goals> |
| <goal>validate</goal> |
| </goals> |
| <phase>validate</phase> |
| <configuration> |
| <validationSets> |
| <validationSet> |
| <dir>src/changelog</dir> |
| <includes> |
| <include>**/*.xml</include> |
| </includes> |
| <!-- Without an explicit `publicId` and `systemId`, `xml:validate` is trying to download every single XSD from every single XML it encounters. |
| This is causing an extreme slowdown for projects with big changelogs, e.g., Log4j. --> |
| <publicId>https://logging.apache.org/xml/ns</publicId> |
| <systemId>https://logging.apache.org/xml/ns/log4j-changelog-0.xsd</systemId> |
| <validating>true</validating> |
| </validationSet> |
| </validationSets> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| </plugins> |
| </build> |
| |
| </profile> |
| |
| <!-- `changelog-release` profile to move `src/changelog/.?.x.x` contents to their associated release directory. |
| It is manually enabled by `.github/workflows/deploy-release-reusable.yaml` to generate release notes. --> |
| <profile> |
| |
| <id>changelog-release</id> |
| |
| <build> |
| |
| <defaultGoal>log4j-changelog:release@release-changelog generate-sources</defaultGoal> |
| |
| <plugins> |
| <plugin> |
| <groupId>org.apache.logging.log4j</groupId> |
| <artifactId>log4j-changelog-maven-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>release-changelog</id> |
| <configuration> |
| <releaseVersion>${project.version}</releaseVersion> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| </plugins> |
| |
| </build> |
| |
| </profile> |
| |
| <!-- `distribution` profile creating the distribution containing: |
| 1. Git-tracked sources |
| 2. Attachments (generated JAR files, etc.) |
| 3. Release notes |
| 4. Auxiliary support files (`README.adoc`, `LICENSE.txt`, etc.) |
| |
| This profile must be executed after a successful `package` phase, since we need JARs. |
| This profile is manually enabled by `.github/workflows/deploy-release-reusable.yaml` while releasing. --> |
| <profile> |
| |
| <id>distribution</id> |
| |
| <build> |
| |
| <defaultGoal>enforcer:enforce@enforce-distribution-arguments bsh:run@create-distribution</defaultGoal> |
| |
| <plugins> |
| |
| <!-- Enforce properties required by the BSH creating the distribution. |
| These properties must match the ones in `.github/workflows/deploy-release-reusable.yaml`! --> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-enforcer-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>enforce-distribution-arguments</id> |
| <goals> |
| <goal>enforce</goal> |
| </goals> |
| <configuration> |
| <rules> |
| <requireProperty> |
| <property>attachmentFilepathPattern</property> |
| <message>You must set an `attachmentFilepathPattern` property for the regex pattern matched against the full filepath for determining attachments to be included in the distribution!</message> |
| </requireProperty> |
| <requireProperty> |
| <property>attachmentCount</property> |
| <message>You must set an `attachmentCount` property for the number of attachments expected to be found!</message> |
| </requireProperty> |
| </rules> |
| <fail>true</fail> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| |
| <!-- Create the distribution ZIP --> |
| <plugin> |
| <groupId>com.github.genthaler</groupId> |
| <artifactId>beanshell-maven-plugin</artifactId> |
| <dependencies> |
| <dependency> |
| <groupId>org.eclipse.jgit</groupId> |
| <artifactId>org.eclipse.jgit</artifactId> |
| <version>${org.eclipse.jgit.version}</version> |
| </dependency> |
| </dependencies> |
| <executions> |
| <execution> |
| <id>create-distribution</id> |
| <goals> |
| <goal>run</goal> |
| </goals> |
| <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; |
| |
| String outputTimestamp = project.getProperties().getProperty("project.build.outputTimestamp"); |
| long timestampMillis = java.time.Instant.parse(outputTimestamp).toEpochMilli(); |
| 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); |
| // Skip directories, which is tracked by Git only when it is a symlink |
| if (Files.isDirectory(path, /* required for BSH method resolution: */ new LinkOption[0])) { |
| continue; |
| } |
| try { |
| ZipEntry zipEntry = new ZipEntry(file); |
| zipEntry.setTime(timestampMillis); |
| zipOutputStream.putNextEntry(zipEntry); |
| zipOutputStream.write(Files.readAllBytes(path)); |
| zipOutputStream.closeEntry(); |
| } catch (Exception error) { |
| String message = String.format( |
| "failed processing file `%s` at path `%s`", |
| new Object[]{file, path}); |
| throw new RuntimeException(message, error); |
| } |
| } |
| } catch (Exception error) { |
| String message = String.format("failed creating ZIP archive `%s`", new Object[]{zipFileName}); |
| Exception extendedError = new RuntimeException(message, error); |
| // Supplement diagnostics |
| extendedError.printStackTrace(System.err); |
| throw extendedError; |
| } 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 the source distribution using Git-tracked files |
| zip("target/src.zip", pathByFile); |
| System.out.format("Generated the source distribution (`src.zip`) containing %d files.%n", new Object[]{pathByFile.size()}); |
| |
| // Short-circuit if there is no binary distribution expected |
| if (${attachmentCount} == 0) { |
| return; |
| } |
| |
| // Find auxiliary files that will go into the binary distribution |
| SortedMap pathByFile = new TreeMap(); |
| pathByFile.put("RELEASE-NOTES.adoc", new File("${project.build.directory}/generated-site/antora/modules/ROOT/pages/_release-notes/${project.version}.adoc").toPath()); |
| pathByFile.put("README.adoc", new File("README.adoc").toPath()); |
| pathByFile.put("NOTICE.txt", new File("NOTICE.txt").toPath()); |
| pathByFile.put("LICENSE.txt", new File("LICENSE.txt").toPath()); |
| |
| // Find attachments that will go into the binary distribution |
| Path projectDir = Paths.get("${maven.multiModuleProjectDirectory}", new String[0]); |
| String attachmentFilepathPattern = "${attachmentFilepathPattern}"; |
| System.out.format("Locating attachments matching the provided pattern: `%s`%n", new Object[] {attachmentFilepathPattern}); |
| SortedMap attachmentPathByFile = new TreeMap(); |
| Stream paths = Files.walk(new File(repoDirectoryParent).toPath(), 32, /* required for BSH method resolution: */ new FileVisitOption[0]); |
| try { |
| paths.forEach(new Consumer() { |
| public void accept(Path path) { |
| if (Files.isRegularFile(path, /* required for BSH method resolution: */ new LinkOption[0])) { |
| String relativePath = projectDir.relativize(path).toString(); |
| if (relativePath.matches(attachmentFilepathPattern)) { |
| attachmentPathByFile.put(path.getFileName().toString(), path); |
| } |
| } |
| } |
| }); |
| } catch (Exception error) { |
| // Supplement diagnostics |
| error.printStackTrace(System.err); |
| throw error; |
| } finally { |
| paths.close(); |
| } |
| |
| // Check if no attachments were found |
| if (${attachmentCount} != attachmentPathByFile.size()) { |
| System.err.println("Attachments:"); |
| int[] i = {0}; |
| attachmentPathByFile.values().forEach(new Consumer() { |
| public void accept(Path path) { |
| System.err.format(" [%2d] %s%n", new Object[]{++i[0], path}); |
| } |
| }); |
| System.err.format( |
| "Error: Was expecting %d attachments, found %d!%n", |
| new Object[]{${attachmentCount}, attachmentPathByFile.size()}); |
| System.err.println("Tip: Have you already executed the Maven `package` goal?"); |
| System.exit(1); |
| } |
| |
| // Create the binary distribution |
| pathByFile.putAll(attachmentPathByFile); |
| zip("target/bin.zip", pathByFile); |
| System.out.format("Generated the binary distribution (`bin.zip`) containing following %d files:%n", new Object[] {pathByFile.size()}); |
| for (String file : pathByFile.keySet()) { |
| System.out.println("-> " + file); |
| }]]></script> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| |
| </plugins> |
| |
| </build> |
| |
| </profile> |
| |
| <!-- `deploy` profile activating deployment-specific configuration. |
| It is manually enabled by `.github/workflows/deploy-{snapshot,release}-reusable.yaml` 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> |
| <executions> |
| <execution> |
| <goals> |
| <goal>sign</goal> |
| </goals> |
| </execution> |
| </executions> |
| </plugin> |
| |
| </plugins> |
| |
| </build> |
| |
| </profile> |
| |
| <!-- `release` profile activating release-specific deployment configuration. |
| It is manually enabled by `.github/workflows/deploy-release-reusable.yaml` while releasing. --> |
| <profile> |
| |
| <id>release</id> |
| |
| <build> |
| <plugins> |
| |
| <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> |
| |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-enforcer-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>enforce-no-snapshots</id> |
| <goals> |
| <goal>enforce</goal> |
| </goals> |
| <configuration> |
| <rules> |
| <requireReleaseDeps> |
| <message>A release cannot have SNAPSHOT dependencies</message> |
| <onlyWhenRelease>true</onlyWhenRelease> |
| </requireReleaseDeps> |
| <requireReleaseVersion> |
| <message>A release cannot be a SNAPSHOT version</message> |
| </requireReleaseVersion> |
| </rules> |
| <fail>true</fail> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| |
| </plugins> |
| </build> |
| |
| </profile> |
| |
| <!-- `antora` profile to generate `target/site` from `src/site/antora` --> |
| <profile> |
| |
| <id>antora</id> |
| |
| <activation> |
| <file> |
| <exists>src/site/antora</exists> |
| </file> |
| </activation> |
| |
| <properties> |
| |
| <!-- disable `maven-site-plugin`--> |
| <maven.site.skip>true</maven.site.skip> |
| <maven.site.deploy.skip>true</maven.site.deploy.skip> |
| |
| </properties> |
| |
| <build> |
| <plugins> |
| |
| <!-- Export release notes to `target/generated-site/antora/modules/ROOT/pages` --> |
| <plugin> |
| <groupId>org.apache.logging.log4j</groupId> |
| <artifactId>log4j-changelog-maven-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>export-changelog</id> |
| <goals> |
| <goal>export</goal> |
| </goals> |
| <phase>pre-site</phase> |
| <configuration> |
| <outputDirectory>${project.build.directory}/generated-site/antora/modules/ROOT/pages</outputDirectory> |
| <indexTemplates> |
| <template> |
| <source>.index.adoc.ftl</source> |
| <target>release-notes.adoc</target> |
| </template> |
| </indexTemplates> |
| <changelogTemplates> |
| <template> |
| <source>.release-notes.adoc.ftl</source> |
| <target>_release-notes/%v.adoc</target> |
| </template> |
| </changelogTemplates> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| |
| <!-- Copy `src/site/antora/antora.tmpl.yml` to `target/antora-yml/antora.yml` --> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-antrun-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>copy-antora-yml</id> |
| <goals> |
| <goal>run</goal> |
| </goals> |
| <phase>pre-site</phase> |
| <configuration> |
| <target> |
| <copy file="${project.basedir}/src/site/antora/antora.tmpl.yml" overwrite="true" tofile="${project.build.directory}/antora-yml/antora.yml" /> |
| </target> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-resources-plugin</artifactId> |
| <executions> |
| |
| <!-- Process `target/antora-yml` and output to `target/generated-site/antora` --> |
| <execution> |
| <id>filter-antora-yml</id> |
| <goals> |
| <goal>copy-resources</goal> |
| </goals> |
| <phase>pre-site</phase> |
| <configuration> |
| <outputDirectory>${project.build.directory}/generated-site/antora</outputDirectory> |
| <resources> |
| <resource> |
| <directory>${project.build.directory}/antora-yml</directory> |
| <filtering>true</filtering> |
| </resource> |
| </resources> |
| </configuration> |
| </execution> |
| |
| <!-- Copy `src/site` to `target/generated-site` --> |
| <execution> |
| <id>copy-site</id> |
| <goals> |
| <goal>copy-resources</goal> |
| </goals> |
| <phase>pre-site</phase> |
| <configuration> |
| <outputDirectory>${project.build.directory}/generated-site</outputDirectory> |
| <resources> |
| <resource> |
| <directory>${project.basedir}/src/site</directory> |
| <excludes> |
| <!-- `filter-antora-yml` execution will populate `antora.yml`, avoid overriding it: --> |
| <exclude>antora/antora.yml</exclude> |
| </excludes> |
| </resource> |
| </resources> |
| </configuration> |
| </execution> |
| |
| </executions> |
| </plugin> |
| |
| <plugin> |
| <groupId>com.github.eirslett</groupId> |
| <artifactId>frontend-maven-plugin</artifactId> |
| <version>${frontend-maven-plugin.version}</version> |
| <executions> |
| |
| <!-- Install Node & NPM --> |
| <execution> |
| <id>install-node-and-npm</id> |
| <goals> |
| <goal>install-node-and-npm</goal> |
| </goals> |
| <phase>pre-site</phase> |
| <configuration> |
| <nodeVersion>v${node.version}</nodeVersion> |
| <npmVersion>${npm.version}</npmVersion> |
| </configuration> |
| </execution> |
| |
| <!-- Install Antora --> |
| <execution> |
| <id>install-antora</id> |
| <goals> |
| <goal>npm</goal> |
| </goals> |
| <phase>pre-site</phase> |
| </execution> |
| |
| </executions> |
| </plugin> |
| |
| <!-- Run Antora --> |
| <plugin> |
| <groupId>org.codehaus.mojo</groupId> |
| <artifactId>exec-maven-plugin</artifactId> |
| <version>${exec-maven-plugin.version}</version> |
| <executions> |
| <execution> |
| <id>run-antora</id> |
| <goals> |
| <goal>exec</goal> |
| </goals> |
| <phase>site</phase> |
| <configuration> |
| <executable>${project.basedir}/node/node</executable> |
| <arguments> |
| <!-- Running `node/node node_modules/.bin/antora antora-playbook.yaml ...` doesn't work on Windows[1]. |
| I come up with the below solution working on both Linux and Windows. |
| Pay attention to the following details: |
| |
| 1. `@antora/cli` is executed programmatically (this is what `node_modules/.bin/antora` does under the hood) |
| 2. Single-quotes must be used (double-quotes get erased and hence cause syntax errors) |
| 3. Relative paths must be used[2] |
| |
| [1] For some reason, the `node_modules/.bin/antora` script is not properly executed. |
| The following works though: `cd node_modules/.bin; ../../node/node antora ../../antora-playbook.yaml`. |
| Motivated by this, tried configuring the `workingDirectory` parameter of the plugin, though it did not help. |
| [2] `${project.basedir}/antora-playbook.yaml` strangely resolves to `C:\Users\user\logging-log4j2\Usersuserlogging-log4j2/antora-playbook.yaml`. |
| I tried using `const path = require('path'); ... path.resolve('${project.basedir}', 'antora-playbook.yaml')`, but it failed with the same error too. --> |
| <argument>--eval</argument> |
| <argument>require('@antora/cli')(['generate', '--playbook', 'antora-playbook.yaml', '--to-dir', 'target/site'])</argument> |
| </arguments> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| |
| </plugins> |
| </build> |
| |
| </profile> |
| |
| <!-- Adds exclusion filter to Spotbugs, if present --> |
| <profile> |
| |
| <id>spotbugs-exclude</id> |
| |
| <activation> |
| <file> |
| <exists>${maven.multiModuleProjectDirectory}/spotbugs-exclude.xml</exists> |
| </file> |
| </activation> |
| |
| <build> |
| <plugins> |
| |
| <plugin> |
| <groupId>com.github.spotbugs</groupId> |
| <artifactId>spotbugs-maven-plugin</artifactId> |
| <configuration> |
| <excludeFilterFile>${maven.multiModuleProjectDirectory}/spotbugs-exclude.xml</excludeFilterFile> |
| </configuration> |
| </plugin> |
| |
| </plugins> |
| </build> |
| |
| </profile> |
| |
| <!-- Generates coverage information --> |
| <profile> |
| |
| <id>coverage</id> |
| |
| <build> |
| <plugins> |
| |
| <plugin> |
| <groupId>org.jacoco</groupId> |
| <artifactId>jacoco-maven-plugin</artifactId> |
| <configuration> |
| <includes> |
| <include>org/apache/log4j/**</include> |
| <include>org/apache/logging/**</include> |
| </includes> |
| <excludes> |
| <!-- Ignore test code --> |
| <exclude>**/test/**</exclude> |
| </excludes> |
| </configuration> |
| <executions> |
| <execution> |
| <id>prepare-jacoco-agent</id> |
| <goals> |
| <goal>prepare-agent</goal> |
| </goals> |
| </execution> |
| <execution> |
| <id>report-test-coverage</id> |
| <goals> |
| <goal>report</goal> |
| </goals> |
| </execution> |
| </executions> |
| </plugin> |
| |
| </plugins> |
| </build> |
| |
| </profile> |
| |
| </profiles> |
| |
| </project> |