Add git metadata to MANIFEST
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 30 Jul 2019 10:11:14 +0000 (12:11 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 30 Jul 2019 10:11:14 +0000 (12:11 +0200)
pom.xml

diff --git a/pom.xml b/pom.xml
index c6c2ec30d3eb5185c7d479c175c6964f74ff83de..bfc3422c4d3dd7853c88ea394b887c66044a464d 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -1,5 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<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">
        <modelVersion>4.0.0</modelVersion>
        <groupId>org.argeo.commons</groupId>
        <artifactId>argeo-commons</artifactId>
@@ -231,6 +233,11 @@ limitations under the License.
                                                <encoding>UTF-8</encoding>
                                        </configuration>
                                </plugin>
+                               <plugin>
+                                       <groupId>pl.project13.maven</groupId>
+                                       <artifactId>git-commit-id-plugin</artifactId>
+                                       <version>3.0.0</version>
+                               </plugin>
                                <plugin>
                                        <artifactId>maven-release-plugin</artifactId>
                                        <version>2.5.1</version>
@@ -253,6 +260,10 @@ limitations under the License.
                                                        <_removeheaders>Bnd-LastModified,Build-Jdk,Built-By,Tool,Created-By</_removeheaders>
                                                        <Automatic-Module-Name>${project.artifactId}</Automatic-Module-Name>
                                                        <SLC-Category>${project.groupId}</SLC-Category>
+                                                       <!-- Git metadata -->
+                                                       <SLC-Git-Commit-Id>${git.commit.id}</SLC-Git-Commit-Id>
+                                                       <SLC-Git-Commit-Describe>${git.commit.id.describe}</SLC-Git-Commit-Describe>
+                                                       <SLC-Git-Commit-Count>${git.closest.tag.commit.count}</SLC-Git-Commit-Count>
                                                </instructions>
                                        </configuration>
                                        <executions>
@@ -308,6 +319,19 @@ limitations under the License.
                                        </filesets>
                                </configuration>
                        </plugin>
+                       <plugin>
+                               <groupId>pl.project13.maven</groupId>
+                               <artifactId>git-commit-id-plugin</artifactId>
+                               <executions>
+                                       <execution>
+                                               <id>get-the-git-infos</id>
+                                               <goals>
+                                                       <goal>revision</goal>
+                                               </goals>
+                                               <phase>initialize</phase>
+                                       </execution>
+                               </executions>
+                       </plugin>
                        <plugin>
                                <artifactId>maven-resources-plugin</artifactId>
                                <configuration>
@@ -481,8 +505,10 @@ limitations under the License.
                                                                </goals>
                                                                <configuration>
                                                                        <target>
-                                                                               <copy todir="${argeo.rpm.stagingRepository}" quiet="true" failonerror="false">
-                                                                                       <fileset dir="${project.build.directory}/rpm" includes="*/RPMS/**/*.rpm" />
+                                                                               <copy todir="${argeo.rpm.stagingRepository}" quiet="true"
+                                                                                       failonerror="false">
+                                                                                       <fileset dir="${project.build.directory}/rpm"
+                                                                                               includes="*/RPMS/**/*.rpm" />
                                                                                        <flattenmapper />
                                                                                </copy>
                                                                        </target>
@@ -507,8 +533,10 @@ limitations under the License.
                                                                </goals>
                                                                <configuration>
                                                                        <target>
-                                                                               <copy todir="${argeo.rpm.stagingRepository}" quiet="true" failonerror="false">
-                                                                                       <fileset dir="${project.build.directory}/rpm" includes="*/RPMS/**/*.rpm" />
+                                                                               <copy todir="${argeo.rpm.stagingRepository}" quiet="true"
+                                                                                       failonerror="false">
+                                                                                       <fileset dir="${project.build.directory}/rpm"
+                                                                                               includes="*/RPMS/**/*.rpm" />
                                                                                        <flattenmapper />
                                                                                </copy>
                                                                        </target>