ASTERIXDB-1136: Make Java compiler target configurable via profile

Change-Id: I10378f9d3fdec9b4951f53c9b370b7741668e537
Reviewed-on: https://asterix-gerrit.ics.uci.edu/273
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/pom.xml b/pom.xml
index 8e4aeec..8f00aac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,6 +46,7 @@
     <jvm.extraargs />
     <!-- Definition of tests in various categories which may be excluded -->
     <hanging.pregelix.tests>**/pregelix/**/FailureRecovery*.java</hanging.pregelix.tests>
+    <jdk.version>1.8</jdk.version>
     <hivesterix.perf.tests>**/hivesterix/perf/PerfTestSuite.java</hivesterix.perf.tests>
     <global.test.includes>**/*TestSuite.java,**/*Test.java</global.test.includes>
     <global.test.excludes>**/Abstract*.java,${hanging.pregelix.tests},${hivesterix.perf.tests}</global.test.excludes>
@@ -190,7 +191,42 @@
           <excludes>
             <exclude>${global.test.excludes},${test.excludes}</exclude>
           </excludes>
-	</configuration>
+   </configuration>
+   </plugin>
+   <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-assembly-plugin</artifactId>
+          <!-- We override the configuration plugin to override the descriptor to use for building
+            the source release zip. Specifically, we would like to control the inclusions/exclusions.
+            For example, we exclude the KEYS file from the zip -->
+          <executions>
+              <execution>
+                  <!-- Use this id to match the id mentioned in the assembly plugin configuration in
+                    the apache parent POM under the apache-release profile -->
+                  <id>source-release-assembly</id>
+                  <phase>package</phase>
+                  <goals>
+                      <goal>single</goal>
+                  </goals>
+                  <!-- combine.self should be override to replace the configuration in the parent POM -->
+                  <configuration combine.self="override">
+                      <runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
+                      <descriptors>
+                          <descriptor>src/main/assembly/source.xml</descriptor>
+                      </descriptors>
+                  </configuration>
+              </execution>
+          </executions>
+      </plugin>
+      <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-compiler-plugin</artifactId>
+            <version>3.1</version>
+            <configuration>
+               <source>${jdk.version}</source>
+               <target>${jdk.version}</target>
+               <compilerArgument>-Xlint:all</compilerArgument>
+            </configuration>
       </plugin>
     </plugins>
   </build>
@@ -242,6 +278,33 @@
         </plugins>
       </build>
     </profile>
+    <profile>
+        <id>java6</id>
+        <activation>
+            <jdk>1.6</jdk>
+        </activation>
+         <properties>
+            <jdk.version>1.6</jdk.version>
+         </properties>
+    </profile>
+    <profile>
+        <id>java7</id>
+        <activation>
+            <jdk>1.7</jdk>
+        </activation>
+         <properties>
+            <jdk.version>1.7</jdk.version>
+         </properties>
+    </profile>
+    <profile>
+        <id>java8</id>
+        <activation>
+            <jdk>1.8</jdk>
+        </activation>
+         <properties>
+            <jdk.version>1.8</jdk.version>
+         </properties>
+    </profile>
   </profiles>
 
   <repositories>