From 62a0030f415c7ad38d6579fa89343358e12d78ba Mon Sep 17 00:00:00 2001
From: Eric Duminil <eric.duminil@gmail.com>
Date: Sat, 11 Apr 2020 21:49:07 +0200
Subject: [PATCH] Trying to add build info to zip & manifest

---
 pom.xml | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/pom.xml b/pom.xml
index 00c06ad..02b2b0c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,11 +3,18 @@
 	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>
 	<groupId>eu.simstadt</groupId>
+
 	<artifactId>RegionChooser</artifactId>
 	<version>0.1.0-SNAPSHOT</version>
 	<properties>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 	</properties>
+
+	<scm>
+		<connection>scm:git:file://${project.baseUri}/.git</connection>
+		<developerConnection>scm:git:file://${project.baseUri}/.git</developerConnection>
+	</scm>
+
 	<dependencies>
 		<!-- https://mvnrepository.com/artifact/junit/junit -->
 		<dependency>
@@ -37,6 +44,7 @@
 	</dependencies>
 	<build>
 		<plugins>
+			<!-- Is it really needed? -->
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-dependency-plugin</artifactId>
@@ -53,6 +61,29 @@
 					</execution>
 				</executions>
 			</plugin>
+
+			<!-- Gets info from git, e.g. hash and datetime -->
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>buildnumber-maven-plugin</artifactId>
+				<version>1.4</version>
+				<executions>
+					<execution>
+						<phase>validate</phase>
+						<goals>
+							<goal>create</goal>
+						</goals>
+					</execution>
+				</executions>
+				<configuration>
+					<timestampFormat>{0,date,yyyyMMdd}</timestampFormat>
+					<shortRevisionLength>7</shortRevisionLength>
+					<doCheck>false</doCheck>
+					<doUpdate>false</doUpdate>
+				</configuration>
+			</plugin>
+
+			<!-- Packs everything in a zip -->
 			<plugin>
 				<artifactId>maven-assembly-plugin</artifactId>
 				<configuration>
@@ -66,6 +97,8 @@
 					<descriptors>
 						<descriptor>${basedir}/buildConfig/assemblyDesc.xml</descriptor>
 					</descriptors>
+					<finalName>RegionChooser_${project.version}_${scmBranch}_${timestamp}_${buildNumber}</finalName>
+					<appendAssemblyId>false</appendAssemblyId>
 				</configuration>
 				<executions>
 					<execution>
@@ -88,6 +121,10 @@
 							<classpathPrefix>libs/</classpathPrefix>
 							<mainClass>eu.simstadt.regionchooser.RegionChooserFX</mainClass>
 						</manifest>
+						<manifestEntries>
+							<Implementation-URL>http://simstadt.hft-stuttgart.de/</Implementation-URL>
+							<Implementation-Version>${project.version} (${scmBranch}, rev. ${buildNumber}, ${timestamp})</Implementation-Version>
+						</manifestEntries>
 					</archive>
 				</configuration>
 			</plugin>
-- 
GitLab