You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2022/12/02 11:59:34 UTC

[commons-math] 02/02: Fix git build number in manifest

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

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git

commit f7ef9b625b303a7c39a8f5903aa56de8aca8e87e
Author: aherbert <ah...@apache.org>
AuthorDate: Fri Dec 2 11:52:57 2022 +0000

    Fix git build number in manifest
---
 pom.xml | 48 ++++++++++++++++--------------------------------
 1 file changed, 16 insertions(+), 32 deletions(-)

diff --git a/pom.xml b/pom.xml
index 9278fbbb8..0124caba1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,11 +86,6 @@
     <commons.scmPubUrl>https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-math</commons.scmPubUrl>
     <commons.scmPubCheckoutDirectory>site-content</commons.scmPubCheckoutDirectory>
 
-    <!-- Temporary fix to replace svn-based build number with git-based build number -->
-    <buildnumber.skip>true</buildnumber.skip>
-    <math.jgit.buildnumber.version>1.2.10</math.jgit.buildnumber.version>
-    <implementation.build>${git.revision}; ${maven.build.timestamp}</implementation.build>
-
     <!--
         Override so that "mvn commons:download-page" will generates a web page
         referring to the files created by the "dist-archive" module.
@@ -396,10 +391,26 @@
             <manifestEntries>
               <!-- Java 9 -->
               <Automatic-Module-Name>${commons.module.name}</Automatic-Module-Name>
+              <!-- Add entries from CP that are not inherited (for reasons unknown).
+                   Replace ${implementation.build} property with the unique git build number. -->
+              <Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
+              <Implementation-Build>${buildNumber}; ${maven.build.timestamp}</Implementation-Build>
+              <X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
+              <X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
             </manifestEntries>
           </archive>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>buildnumber-maven-plugin</artifactId>
+        <configuration>
+          <!-- buildnumber-maven-plugin:
+            "for git getLastChangedRevision() returns null instead of the last revision"
+            Override CP to use the last revision of the repository (OK for release jars). -->
+          <useLastCommittedRevision>false</useLastCommittedRevision>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
@@ -506,33 +517,6 @@
   </reporting>
 
   <profiles>
-    <profile>
-      <id>jgit-buildnumber</id>
-      <activation>
-        <file>
-          <exists>.git</exists>
-        </file>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>ru.concerteza.buildnumber</groupId>
-            <artifactId>maven-jgit-buildnumber-plugin</artifactId>
-            <version>${math.jgit.buildnumber.version}</version>
-            <executions>
-              <execution>
-                <phase>generate-resources</phase>
-                <goals>
-                  <goal>extract-buildnumber</goal>
-                </goals>
-              </execution>
-            </executions>
-            <configuration>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
     <profile>
       <!-- Override a parent property if the SVN site checkout should not be performed.
            This should activate for child modules. -->