You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2022/12/21 21:08:03 UTC

[logging-log4j-tools] 05/05: Create `log4j-tools-bom` and `log4j-tools-parent` POMs

This is an automated email from the ASF dual-hosted git repository.

vy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j-tools.git

commit 1e9e66f20f6e644d21e246d4fb25942be7fbc42a
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Wed Dec 21 10:16:45 2022 +0100

    Create `log4j-tools-bom` and `log4j-tools-parent` POMs
---
 log4j-changelog/pom.xml               |   3 +-
 pom.xml => log4j-tools-parent/pom.xml |  93 ++-------------
 pom.xml                               | 208 ++++++++--------------------------
 3 files changed, 62 insertions(+), 242 deletions(-)

diff --git a/log4j-changelog/pom.xml b/log4j-changelog/pom.xml
index a826146..bd71dd0 100644
--- a/log4j-changelog/pom.xml
+++ b/log4j-changelog/pom.xml
@@ -22,9 +22,10 @@
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <artifactId>log4j-tools</artifactId>
+    <artifactId>log4j-tools-parent</artifactId>
     <groupId>org.apache.logging.log4j.tools</groupId>
     <version>${revision}</version>
+    <relativePath>../log4j-tools-parent/pom.xml</relativePath>
   </parent>
 
   <artifactId>log4j-changelog</artifactId>
diff --git a/pom.xml b/log4j-tools-parent/pom.xml
similarity index 77%
copy from pom.xml
copy to log4j-tools-parent/pom.xml
index 4735c81..7ebb4a1 100644
--- a/pom.xml
+++ b/log4j-tools-parent/pom.xml
@@ -22,24 +22,18 @@
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.apache.logging</groupId>
-    <artifactId>logging-parent</artifactId>
-    <version>7</version>
+    <groupId>org.apache.logging.log4j.tools</groupId>
+    <artifactId>log4j-tools-bom</artifactId>
+    <version>${revision}</version>
   </parent>
 
-  <groupId>org.apache.logging.log4j.tools</groupId>
-  <artifactId>log4j-tools</artifactId>
+  <artifactId>log4j-tools-parent</artifactId>
   <packaging>pom</packaging>
   <version>${revision}</version>
 
-  <modules>
-    <module>log4j-changelog</module>
-  </modules>
-
   <properties>
 
-    <!-- common properties -->
-    <revision>0.1.0-SNAPSHOT</revision>
+    <!-- project properties -->
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
@@ -53,13 +47,16 @@
     <!-- `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>
 
+    <!-- disable `maven-site-plugin`-->
+    <maven.site.skip>true</maven.site.skip>
+    <maven.site.deploy.skip>true</maven.site.deploy.skip>
+
     <!-- dependency versions -->
     <spotbugs.version>4.7.3</spotbugs.version>
 
     <!-- plugin versions -->
     <error-prone.version>2.16</error-prone.version>
     <findsecbugs-plugin.version>1.12.0</findsecbugs-plugin.version>
-    <flatten-maven-plugin.version>1.3.0</flatten-maven-plugin.version>
     <spotbugs-maven-plugin.version>${spotbugs.version}.0</spotbugs-maven-plugin.version>
     <spotless-maven-plugin.version>2.28.0</spotless-maven-plugin.version>
 
@@ -138,7 +135,7 @@
             </goals>
           </execution>
           <execution>
-            <id>clean-revision</id>
+            <id>clean-flattened-revision</id>
             <phase>clean</phase>
             <goals>
               <goal>clean</goal>
@@ -253,74 +250,4 @@
 
   </build>
 
-  <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>
-
-  <scm>
-    <url>https://github.com/apache/logging-log4j-tools</url>
-    <connection>scm:git:git@github.com:apache/logging-log4j-tools.git</connection>
-    <developerConnection>scm:git:git@github.com:apache/logging-log4j-tools.git</developerConnection>
-    <tag>HEAD</tag>
-  </scm>
-
-  <url>https://github.com/apache/logging-log4j-tools</url>
-
-  <issueManagement>
-    <system>GitHub Issues</system>
-    <url>https://github.com/apache/logging-log4j-tools/issues</url>
-  </issueManagement>
-
-  <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>
-
-  <organization>
-    <name>Apache Software Foundation</name>
-    <url>https://apache.org</url>
-  </organization>
-
-  <inceptionYear>2022</inceptionYear>
-
-  <developers>
-
-    <developer>
-      <id>rgoers</id>
-      <name>Ralph Goers</name>
-      <email>rgoers@apache.org</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>vy@apache.org</email>
-      <roles>
-        <role>PMC Member</role>
-      </roles>
-      <timezone>Europe/Amsterdam</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>
-
-  </developers>
-
 </project>
diff --git a/pom.xml b/pom.xml
index 4735c81..78a7e8f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,6 +19,15 @@
          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>
@@ -28,21 +37,24 @@
   </parent>
 
   <groupId>org.apache.logging.log4j.tools</groupId>
-  <artifactId>log4j-tools</artifactId>
+  <artifactId>log4j-tools-bom</artifactId>
   <packaging>pom</packaging>
   <version>${revision}</version>
 
   <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>
+
   </modules>
 
   <properties>
 
-    <!-- common properties -->
+    <!-- project version -->
     <revision>0.1.0-SNAPSHOT</revision>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
-    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 
     <!-- `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.
@@ -53,24 +65,19 @@
     <!-- `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 -->
-    <spotbugs.version>4.7.3</spotbugs.version>
-
     <!-- plugin versions -->
-    <error-prone.version>2.16</error-prone.version>
-    <findsecbugs-plugin.version>1.12.0</findsecbugs-plugin.version>
     <flatten-maven-plugin.version>1.3.0</flatten-maven-plugin.version>
-    <spotbugs-maven-plugin.version>${spotbugs.version}.0</spotbugs-maven-plugin.version>
-    <spotless-maven-plugin.version>2.28.0</spotless-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>com.github.spotbugs</groupId>
-        <artifactId>spotbugs-annotations</artifactId>
-        <version>${spotbugs.version}</version>
+        <groupId>org.apache.logging.log4j.tools</groupId>
+        <artifactId>log4j-changelog</artifactId>
+        <version>${project.version}</version>
       </dependency>
     </dependencies>
   </dependencyManagement>
@@ -79,174 +86,54 @@
 
     <pluginManagement>
       <plugins>
-
         <plugin>
-          <groupId>com.github.spotbugs</groupId>
-          <artifactId>spotbugs-maven-plugin</artifactId>
-          <version>${spotbugs-maven-plugin.version}</version>
+          <groupId>org.codehaus.mojo</groupId>
+          <artifactId>flatten-maven-plugin</artifactId>
+          <version>${flatten-maven-plugin.version}</version>
         </plugin>
-
-        <plugin>
-          <groupId>com.diffplug.spotless</groupId>
-          <artifactId>spotless-maven-plugin</artifactId>
-          <version>${spotless-maven-plugin.version}</version>
-        </plugin>
-
       </plugins>
     </pluginManagement>
 
     <plugins>
 
-      <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>
-
-      <!-- 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 -->
+      <!-- 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>
-        <configuration>
-          <updatePomFile>true</updatePomFile>
-          <flattenMode>resolveCiFriendliesOnly</flattenMode>
-        </configuration>
+        <inherited>false</inherited>
         <executions>
           <execution>
-            <id>flatten-revision</id>
+            <id>flatten-bom</id>
             <phase>process-resources</phase>
             <goals>
               <goal>flatten</goal>
             </goals>
-          </execution>
-          <execution>
-            <id>clean-revision</id>
-            <phase>clean</phase>
-            <goals>
-              <goal>clean</goal>
-            </goals>
-          </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>
-            <exclude>**/target/**/*</exclude>
-            <exclude>.java-version</exclude>
-            <exclude>.mvn/jvm.config</exclude>
-            <!-- IntelliJ IDEA files: -->
-            <exclude>.idea/**/*</exclude>
-            <exclude>**/*.iml</exclude>
-          </excludes>
-        </configuration>
-        <executions>
-          <execution>
-            <phase>verify</phase>
-            <goals>
-              <goal>check</goal>
-            </goals>
-          </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>
+              <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>
-
-      <!-- Configuration here must match the one in `.editorconfig`! -->
-      <plugin>
-        <groupId>com.diffplug.spotless</groupId>
-        <artifactId>spotless-maven-plugin</artifactId>
-        <executions>
           <execution>
-            <id>default-spotless</id>
-            <phase>verify</phase>
-            <goals>
-              <goal>check</goal>
-            </goals>
-          </execution>
-        </executions>
-        <configuration>
-          <java>
-            <licenseHeader>
-              <file>${maven.multiModuleProjectDirectory}/spotless-license-header.txt</file>
-            </licenseHeader>
-            <trimTrailingWhitespace/>
-            <endWithNewline/>
-            <removeUnusedImports/>
-            <indent>
-              <spaces>true</spaces>
-              <spacesPerTab>4</spacesPerTab>
-            </indent>
-            <importOrder>
-              <order>java,javax,org.apache.logging,,\#java,\#javax,\#org.apache.logging,\#</order>
-            </importOrder>
-          </java>
-        </configuration>
-      </plugin>
-
-      <plugin>
-        <groupId>com.github.spotbugs</groupId>
-        <artifactId>spotbugs-maven-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>default-spotbugs</id>
-            <phase>verify</phase>
+            <id>clean-flattened-bom</id>
+            <phase>clean</phase>
             <goals>
-              <goal>check</goal>
+              <goal>clean</goal>
             </goals>
           </execution>
         </executions>
-        <configuration>
-          <plugins>
-            <plugin>
-              <groupId>com.h3xstream.findsecbugs</groupId>
-              <artifactId>findsecbugs-plugin</artifactId>
-              <version>${findsecbugs-plugin.version}</version>
-            </plugin>
-          </plugins>
-        </configuration>
       </plugin>
 
     </plugins>
@@ -267,6 +154,11 @@
 
   <url>https://github.com/apache/logging-log4j-tools</url>
 
+  <ciManagement>
+    <system>GitHub Actions</system>
+    <url>https://github.com/apache/logging-log4j-tools/actions</url>
+  </ciManagement>
+
   <issueManagement>
     <system>GitHub Issues</system>
     <url>https://github.com/apache/logging-log4j-tools/issues</url>