]> source.dussan.org Git - sonarqube.git/commitdiff
Add the entries "Implementation-Build" (Git revision) and "Build-Time" to JAR/WAR...
authorSimon Brandhof <simon.brandhof@gmail.com>
Tue, 10 Apr 2012 19:40:19 +0000 (21:40 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Tue, 10 Apr 2012 19:40:19 +0000 (21:40 +0200)
Note that plugins are not supported yet because of http://jira.codehaus.org/browse/SONAR-3405

pom.xml
sonar-server/pom.xml

diff --git a/pom.xml b/pom.xml
index 39ed5ef6a629a7d15f82864cc734df13d4491763..74c0245285cbb4e0c66c3871dc2733c7f2d82e02 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -1,5 +1,6 @@
 <?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.codehaus.sonar</groupId>
@@ -91,6 +92,8 @@
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <maven.min.version>2.2.1</maven.min.version>
     <jdk.min.version>1.5</jdk.min.version>
+    <timestamp>${maven.build.timestamp}</timestamp>
+    <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format>
 
     <!-- To configure animal-sniffer to check API compat -->
     <animal-sniffer.signature.groupId>org.codehaus.mojo.signature</animal-sniffer.signature.groupId>
     <skipSanityChecks>false</skipSanityChecks>
 
     <!-- default GWT configuration. It's overridden by the profile 'dev' to speed up compilation in dev environments-->
-    <gwt.permutationSuffix />
+    <gwt.permutationSuffix/>
     <gwt.extraJvmArgs>-Xmx512m -Xss1024k</gwt.extraJvmArgs>
     <sonar.snapshotRepository.url>dav:https://dav.codehaus.org/snapshots.repository/sonar</sonar.snapshotRepository.url>
   </properties>
             </archiverConfig>
           </configuration>
         </plugin>
+        <plugin>
+          <groupId>org.codehaus.mojo</groupId>
+          <artifactId>buildnumber-maven-plugin</artifactId>
+          <version>1.0</version>
+        </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-clean-plugin</artifactId>
     </pluginManagement>
 
     <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>buildnumber-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>validate</phase>
+            <goals>
+              <goal>create</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <doCheck>false</doCheck>
+          <doUpdate>false</doUpdate>
+          <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
+          <revisionOnScmFailure>0</revisionOnScmFailure>
+        </configuration>
+      </plugin>
+
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
                   <onlyWhenRelease>true</onlyWhenRelease>
                 </requireReleaseDeps>
                 <requireJavaVersion>
-                  <message>To build this project JDK ${jdk.min.version} (or upper) is required. Please install it.</message>
+                  <message>To build this project JDK ${jdk.min.version} (or upper) is required. Please install it.
+                  </message>
                   <version>${jdk.min.version}</version>
                 </requireJavaVersion>
                 <requireMavenVersion>
-                  <message>To build this project Maven ${maven.min.version} (or upper) is required. Please install it.</message>
+                  <message>To build this project Maven ${maven.min.version} (or upper) is required. Please install it.
+                  </message>
                   <version>${maven.min.version}</version>
                 </requireMavenVersion>
                 <bannedDependencies>
               <rules>
                 <requireNoRepositories>
                   <!-- Also see SONAR-2849 -->
-                  <message>The rules for repo1.maven.org are that pom.xml files should not include repository definitions.</message>
+                  <message>The rules for repo1.maven.org are that pom.xml files should not include repository
+                    definitions.
+                  </message>
                 </requireNoRepositories>
               </rules>
             </configuration>
           <archive>
             <manifestEntries>
               <Version>${project.version}</Version>
+              <!-- ${buildNumber} is the Git revision. It's generated by the buildnumber-maven-plugin -->
+              <Implementation-Build>${buildNumber}</Implementation-Build>
+              <Build-Time>${timestamp}</Build-Time>
             </manifestEntries>
           </archive>
         </configuration>
         <configuration>
           <groupByLicense>true</groupByLicense>
           <licenseMerges>
-            <licenseMerge>The Apache Software License, Version 2.0|Apache License 2.0|Apache 2|Apache License Version 2|Apache License Version 2.0|Apache Public License 2.0|Apache Software License - Version 2.0|Apache Software Licenses</licenseMerge>
-            <licenseMerge>GNU Lesser General Public License, Version 2.1|GNU Lesser General Public License Version 2.1|GNU Lesser General Public License (LGPL), Version 2.1</licenseMerge>
+            <licenseMerge>The Apache Software License, Version 2.0|Apache License 2.0|Apache 2|Apache License Version
+              2|Apache License Version 2.0|Apache Public License 2.0|Apache Software License - Version 2.0|Apache
+              Software Licenses
+            </licenseMerge>
+            <licenseMerge>GNU Lesser General Public License, Version 2.1|GNU Lesser General Public License Version
+              2.1|GNU Lesser General Public License (LGPL), Version 2.1
+            </licenseMerge>
             <licenseMerge>BSD|BSD License|The BSD License</licenseMerge>
-            <licenseMerge>Common Public License, Version 1.0|Common Public License - v 1.0|Common Public License Version 1.0</licenseMerge>
+            <licenseMerge>Common Public License, Version 1.0|Common Public License - v 1.0|Common Public License Version
+              1.0
+            </licenseMerge>
             <licenseMerge>Eclipse Public License, Version 1.0|Eclipse Public License - Version 1.0</licenseMerge>
-            <licenseMerge>Common Development and Distribution License, Version 1.0|COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0|Common Development and Distribution License (CDDL) v1.0</licenseMerge>
+            <licenseMerge>Common Development and Distribution License, Version 1.0|COMMON DEVELOPMENT AND DISTRIBUTION
+              LICENSE (CDDL) Version 1.0|Common Development and Distribution License (CDDL) v1.0
+            </licenseMerge>
             <licenseMerge>MIT License|The MIT License</licenseMerge>
           </licenseMerges>
         </configuration>
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-javadoc-plugin</artifactId>
-              <configuration>
-                <excludePackageNames>
-            net.*:org.sonar.application:org.sonar.server:org.sonar.graph:org.sonar.batch:org.sonar.channel:org.sonar.java:org.sonar.maven*:org.sonar.plugins.*:org.sonar.colorizer:org.sonar.squid:org.sonar.core:org.sonar.jpa:org.sonar.duplications:org.sonar.markdown:com.*
+            <configuration>
+              <excludePackageNames>
+                net.*:org.sonar.application:org.sonar.server:org.sonar.graph:org.sonar.batch:org.sonar.channel:org.sonar.java:org.sonar.maven*:org.sonar.plugins.*:org.sonar.colorizer:org.sonar.squid:org.sonar.core:org.sonar.jpa:org.sonar.duplications:org.sonar.markdown:com.*
               </excludePackageNames>
               <author>false</author>
               <linksource>true</linksource>
-              <reportOutputDirectory>${project.reporting.outputDirectory}/${project.version}/apidocs</reportOutputDirectory>
+              <reportOutputDirectory>${project.reporting.outputDirectory}/${project.version}/apidocs
+              </reportOutputDirectory>
             </configuration>
           </plugin>
         </plugins>
                         </goals>
                       </pluginExecutionFilter>
                       <action>
-                        <ignore />
+                        <ignore/>
                       </action>
                     </pluginExecution>
                     <pluginExecution>
                         </goals>
                       </pluginExecutionFilter>
                       <action>
-                        <ignore />
+                        <ignore/>
                       </action>
                     </pluginExecution>
                     <pluginExecution>
                         </goals>
                       </pluginExecutionFilter>
                       <action>
-                        <ignore />
+                        <ignore/>
                       </action>
                     </pluginExecution>
                     <pluginExecution>
                         </goals>
                       </pluginExecutionFilter>
                       <action>
-                        <ignore />
+                        <ignore/>
                       </action>
                     </pluginExecution>
                     <pluginExecution>
                         </goals>
                       </pluginExecutionFilter>
                       <action>
-                        <ignore />
+                        <ignore/>
                       </action>
                     </pluginExecution>
                   </pluginExecutions>
index ce15518e512676820de9f5fe1e7e6e160fff023c..ac291a11f25c41b55bd20e6d4b6b5af07a9ec90b 100644 (file)
           </warSourceExcludes>
           <archive>
             <manifestEntries>
-              <version>${project.version}</version>
+              <Version>${project.version}</Version>
+              <!-- ${buildNumber} is the Git revision. It's generated by the buildnumber-maven-plugin -->
+              <Implementation-Build>${buildNumber}</Implementation-Build>
+              <Build-Time>${timestamp}</Build-Time>
             </manifestEntries>
           </archive>
         </configuration>