From c1d2126ea3537969d74c829ca0156cef310ea697 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Fri, 04 Mar 2016 16:35:30 +0000
Subject: [PATCH] OPENDJ-2582 Factor out buildnumber plugin in poms

---
 opendj-sdk/opendj-sdk-parent/pom.xml |   19 +++++++++++++++++++
 opendj-sdk/opendj-core/pom.xml       |   12 ++----------
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/opendj-sdk/opendj-core/pom.xml b/opendj-sdk/opendj-core/pom.xml
index 51d8e40..fef52fa 100644
--- a/opendj-sdk/opendj-core/pom.xml
+++ b/opendj-sdk/opendj-core/pom.xml
@@ -96,18 +96,10 @@
                 </executions>
             </plugin>
 
+            <!-- Retrieve the SCM revision number and store it into the ${buildRevision} property -->
             <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>
             </plugin>
 
             <!-- Creates opendj-core bundle -->
@@ -123,7 +115,7 @@
                             org.forgerock.opendj.ldif
                         </Export-Package>
                         <Build-Maven>Apache Maven ${maven.version}</Build-Maven>
-                        <SCM-Revision>${buildNumber}</SCM-Revision>
+                        <SCM-Revision>${buildRevision}</SCM-Revision>
                         <SCM-Branch>${scmBranch}</SCM-Branch>
                         <Build-Time>${maven.build.timestamp}</Build-Time>
                         <Build-Java>${java.version}</Build-Java>
diff --git a/opendj-sdk/opendj-sdk-parent/pom.xml b/opendj-sdk/opendj-sdk-parent/pom.xml
index 171d75e..088aa25 100644
--- a/opendj-sdk/opendj-sdk-parent/pom.xml
+++ b/opendj-sdk/opendj-sdk-parent/pom.xml
@@ -181,6 +181,25 @@
                     </configuration>
                 </plugin>
 
+                <!-- Retrieve the SCM revision number -->
+                <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>buildnumber-maven-plugin</artifactId>
+                    <version>1.4</version>
+                    <executions>
+                        <execution>
+                            <id>generate-buildnumber</id>
+                            <goals>
+                                <goal>create</goal>
+                            </goals>
+                            <configuration>
+                                <buildNumberPropertyName>buildRevision</buildNumberPropertyName>
+                                <revisionOnScmFailure>-1</revisionOnScmFailure>
+                            </configuration>
+                        </execution>
+                    </executions>
+                </plugin>
+
                 <plugin>
                     <groupId>org.apache.felix</groupId>
                     <artifactId>maven-bundle-plugin</artifactId>

--
Gitblit v1.10.0