Skip to content

Commit 26c9215

Browse files
committed
Add a new property dedicated to the continuous deployment of the project.
Add a new Maven plugin to get the current commit hash from git and add a configuration section to the source, jar and war plugins in order to set additional properties into the MANIFEST.MF file: the git commit hash, the build version and the build timestamp. The git commit hash will be used by our CI to determine from which commit hash the release of a stable version has to be done. The sources are also packaged and deployed into our Nexus repo.
1 parent 59ec8a7 commit 26c9215

File tree

1 file changed

+68
-1
lines changed

1 file changed

+68
-1
lines changed

pom.xml

+68-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright (C) 2000 - 2017 Silverpeas
4+
Copyright (C) 2000 - 2018 Silverpeas
55
66
This program is free software: you can redistribute it and/or modify
77
it under the terms of the GNU Affero General Public License as
@@ -94,6 +94,8 @@
9494
</distributionManagement>
9595

9696
<properties>
97+
<!-- property used by the CI to both deploy a build version and release the next stable version -->
98+
<next.release>1.0</next.release>
9799
<maven.compiler.source>1.8</maven.compiler.source>
98100
<maven.compiler.target>1.8</maven.compiler.target>
99101
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -194,8 +196,73 @@
194196
<showDeprecation>true</showDeprecation>
195197
</configuration>
196198
</plugin>
199+
<plugin>
200+
<groupId>org.apache.maven.plugins</groupId>
201+
<artifactId>maven-source-plugin</artifactId>
202+
<version>3.0.1</version>
203+
<configuration>
204+
<archive>
205+
<manifestEntries>
206+
<Build-Version>${project.version}</Build-Version>
207+
<Git-Commit>${git.commit.id.abbrev}</Git-Commit>
208+
<Build-Timestamp>${maven.build.timestamp}</Build-Timestamp>
209+
</manifestEntries>
210+
</archive>
211+
</configuration>
212+
</plugin>
213+
<plugin>
214+
<groupId>org.apache.maven.plugins</groupId>
215+
<artifactId>maven-jar-plugin</artifactId>
216+
<version>3.0.2</version>
217+
<configuration>
218+
<archive>
219+
<manifestEntries>
220+
<Build-Version>${project.version}</Build-Version>
221+
<Git-Commit>${git.commit.id.abbrev}</Git-Commit>
222+
<Build-Timestamp>${maven.build.timestamp}</Build-Timestamp>
223+
</manifestEntries>
224+
</archive>
225+
</configuration>
226+
</plugin>
227+
<plugin>
228+
<groupId>pl.project13.maven</groupId>
229+
<artifactId>git-commit-id-plugin</artifactId>
230+
<version>2.2.4</version>
231+
<configuration>
232+
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
233+
<dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
234+
<generateGitPropertiesFile>false</generateGitPropertiesFile>
235+
</configuration>
236+
</plugin>
197237
</plugins>
198238
</pluginManagement>
239+
<plugins>
240+
<plugin>
241+
<groupId>org.apache.maven.plugins</groupId>
242+
<artifactId>maven-source-plugin</artifactId>
243+
<executions>
244+
<execution>
245+
<id>attach-sources</id>
246+
<phase>verify</phase>
247+
<goals>
248+
<goal>jar-no-fork</goal>
249+
</goals>
250+
</execution>
251+
</executions>
252+
</plugin>
253+
<plugin>
254+
<groupId>pl.project13.maven</groupId>
255+
<artifactId>git-commit-id-plugin</artifactId>
256+
<executions>
257+
<execution>
258+
<phase>validate</phase>
259+
<goals>
260+
<goal>revision</goal>
261+
</goals>
262+
</execution>
263+
</executions>
264+
</plugin>
265+
</plugins>
199266
</build>
200267

201268
<profiles>

0 commit comments

Comments
 (0)