ASTERIXDB-1136: Make Java compiler target configurable via profile

Change-Id: I4d5ebe26d99ec8c9789eed9bd6f2574f2c51608d
Reviewed-on: https://asterix-gerrit.ics.uci.edu/274
Reviewed-by: Till Westmann <tillw@apache.org>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterix-algebra/pom.xml b/asterix-algebra/pom.xml
index 1535c94..d8038f3 100644
--- a/asterix-algebra/pom.xml
+++ b/asterix-algebra/pom.xml
@@ -38,16 +38,6 @@
 	<build>
 		<plugins>
 			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>2.3.2</version>
-				<configuration>
-					<source>1.7</source>
-					<target>1.7</target>
-					<fork>true</fork>
-				</configuration>
-			</plugin>
-			<plugin>
 				<groupId>org.codehaus.mojo</groupId>
 				<artifactId>javacc-maven-plugin</artifactId>
 				<version>2.6</version>
@@ -66,8 +56,6 @@
 		</plugins>
 		<pluginManagement>
 			<plugins>
-				<!--This plugin's configuration is used to store Eclipse m2e settings 
-					only. It has no influence on the Maven build itself. -->
 				<plugin>
 					<groupId>org.eclipse.m2e</groupId>
 					<artifactId>lifecycle-mapping</artifactId>
diff --git a/asterix-app/pom.xml b/asterix-app/pom.xml
index 95d9e29..2889908 100644
--- a/asterix-app/pom.xml
+++ b/asterix-app/pom.xml
@@ -40,16 +40,6 @@
     <build>
         <plugins>
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>2.3.2</version>
-                <configuration>
-                    <source>1.7</source>
-                    <target>1.7</target>
-                    <fork>true</fork>
-                </configuration>
-            </plugin>
-            <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>appassembler-maven-plugin</artifactId>
                 <version>1.0</version>
diff --git a/asterix-aql/pom.xml b/asterix-aql/pom.xml
index 91f05b9..189f71c 100644
--- a/asterix-aql/pom.xml
+++ b/asterix-aql/pom.xml
@@ -40,16 +40,6 @@
     <build>
         <plugins>
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>2.3.2</version>
-                <configuration>
-                    <source>1.7</source>
-                    <target>1.7</target>
-                    <fork>true</fork>
-                </configuration>
-            </plugin>
-            <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>javacc-maven-plugin</artifactId>
                 <version>2.6</version>
diff --git a/asterix-common/pom.xml b/asterix-common/pom.xml
index 652a761..61a21b2 100644
--- a/asterix-common/pom.xml
+++ b/asterix-common/pom.xml
@@ -37,16 +37,6 @@
 	<build>
 		<plugins>
 			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>2.3.2</version>
-				<configuration>
-					<source>1.7</source>
-					<target>1.7</target>
-					<fork>true</fork>
-				</configuration>
-			</plugin>
-			<plugin>
 				<groupId>org.jvnet.jaxb2.maven2</groupId>
 				<artifactId>maven-jaxb2-plugin</artifactId>
 				<version>0.9.0</version>
@@ -238,4 +228,3 @@
 	</dependencies>
 
 </project>
-
diff --git a/asterix-events/pom.xml b/asterix-events/pom.xml
index a228c3c..1a4ec2a 100644
--- a/asterix-events/pom.xml
+++ b/asterix-events/pom.xml
@@ -45,15 +45,6 @@
 	<build>
 		<plugins>
 			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>2.3.2</version>
-				<configuration>
-					<source>1.7</source>
-					<target>1.7</target>
-				</configuration>
-			</plugin>
-			<plugin>
 				<groupId>org.jvnet.jaxb2.maven2</groupId>
 				<artifactId>maven-jaxb2-plugin</artifactId>
 				<version>0.9.0</version>
diff --git a/asterix-examples/pom.xml b/asterix-examples/pom.xml
index 2f536d6..0bb1321 100644
--- a/asterix-examples/pom.xml
+++ b/asterix-examples/pom.xml
@@ -70,4 +70,4 @@
 		</plugins>
 	</build>
 	<packaging>pom</packaging>
-</project> 
+</project>
diff --git a/asterix-external-data/pom.xml b/asterix-external-data/pom.xml
index 3163b1b..735b672 100644
--- a/asterix-external-data/pom.xml
+++ b/asterix-external-data/pom.xml
@@ -38,16 +38,6 @@
 	<build>
 		<plugins>
 			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>2.3.2</version>
-				<configuration>
-					<source>1.7</source>
-					<target>1.7</target>
-					<fork>true</fork>
-				</configuration>
-			</plugin>
-			<plugin>
 				<groupId>org.jvnet.jaxb2.maven2</groupId>
 				<artifactId>maven-jaxb2-plugin</artifactId>
 				<version>0.9.0</version>
@@ -207,4 +197,4 @@
 			<version>2.3-20090302111651</version>
 		</dependency>
 	</dependencies>
-</project> 
+</project>
diff --git a/asterix-fuzzyjoin/pom.xml b/asterix-fuzzyjoin/pom.xml
index c1265b6..c0264da 100644
--- a/asterix-fuzzyjoin/pom.xml
+++ b/asterix-fuzzyjoin/pom.xml
@@ -1,3 +1,17 @@
+<!--
+ ! Copyright 2009-2013 by The Regents of the University of California
+ ! Licensed under the Apache License, Version 2.0 (the "License");
+ ! you may not use this file except in compliance with the License.
+ ! you may obtain a copy of the License from
+ !
+ !     http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing, software
+ ! distributed under the License is distributed on an "AS IS" BASIS,
+ ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ! See the License for the specific language governing permissions and
+ ! limitations under the License.
+ !-->
 <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>
   <parent>
@@ -22,18 +36,6 @@
     <plugins>
       <plugin>
     <groupId>org.apache.maven.plugins</groupId>
-    <artifactId>maven-compiler-plugin</artifactId>
-    <version>2.3.2</version>
-    <configuration>
-      <source>1.7</source>
-      <target>1.7</target>
-      <compilerArguments>
-        <encoding>utf8</encoding>
-      </compilerArguments>
-    </configuration>
-      </plugin>
-      <plugin>
-    <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-jar-plugin</artifactId>
     <version>2.4</version>
     <executions>
@@ -53,7 +55,6 @@
 
   <dependencies>
     <dependency>
-      <!-- Dependency management inherited from top-level asterixdb -->
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
     </dependency>
diff --git a/asterix-installer/pom.xml b/asterix-installer/pom.xml
index 3eb3dfa..babf16a 100644
--- a/asterix-installer/pom.xml
+++ b/asterix-installer/pom.xml
@@ -42,15 +42,6 @@
 	<build>
 		<plugins>
 			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>2.3.2</version>
-				<configuration>
-					<source>1.7</source>
-					<target>1.7</target>
-				</configuration>
-			</plugin>
-			<plugin>
 				<groupId>org.jvnet.jaxb2.maven2</groupId>
 				<artifactId>maven-jaxb2-plugin</artifactId>
 				<version>0.9.0</version>
diff --git a/asterix-maven-plugins/lexer-generator-maven-plugin/pom.xml b/asterix-maven-plugins/lexer-generator-maven-plugin/pom.xml
index 121f671..7cd489e 100644
--- a/asterix-maven-plugins/lexer-generator-maven-plugin/pom.xml
+++ b/asterix-maven-plugins/lexer-generator-maven-plugin/pom.xml
@@ -29,24 +29,8 @@
   <packaging>maven-plugin</packaging>
   <name>lexer-generator-maven-plugin</name>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>2.3.2</version>
-        <configuration>
-          <source>1.7</source>
-          <target>1.7</target>
-	  <fork>true</fork>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
   <dependencies>
     <dependency>
-      <!-- Dependency management inherited from top-level asterixdb -->
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
     </dependency>
diff --git a/asterix-maven-plugins/record-manager-generator-maven-plugin/pom.xml b/asterix-maven-plugins/record-manager-generator-maven-plugin/pom.xml
index 4b27274..d342263 100644
--- a/asterix-maven-plugins/record-manager-generator-maven-plugin/pom.xml
+++ b/asterix-maven-plugins/record-manager-generator-maven-plugin/pom.xml
@@ -29,21 +29,6 @@
   <packaging>maven-plugin</packaging>
   <name>record-manager-generator-maven-plugin</name>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>2.3.2</version>
-        <configuration>
-          <source>1.7</source>
-          <target>1.7</target>
-          <fork>true</fork>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
   <dependencies>
     <dependency>
       <groupId>org.apache.maven</groupId>
diff --git a/asterix-metadata/pom.xml b/asterix-metadata/pom.xml
index a325a4e..42ee18d 100644
--- a/asterix-metadata/pom.xml
+++ b/asterix-metadata/pom.xml
@@ -34,21 +34,6 @@
     </license>
   </licenses>
 
-	<build>
-		<plugins>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>2.3.2</version>
-				<configuration>
-					<source>1.7</source>
-					<target>1.7</target>
-					<fork>true</fork>
-				</configuration>
-			</plugin>
-		</plugins>
-	</build>
-
 	<dependencies>
 		<dependency>
 			<groupId>org.apache.asterix</groupId>
diff --git a/asterix-om/pom.xml b/asterix-om/pom.xml
index efe7c1d..e3a5c6f 100644
--- a/asterix-om/pom.xml
+++ b/asterix-om/pom.xml
@@ -34,21 +34,6 @@
     </license>
   </licenses>
 
-	<build>
-		<plugins>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>2.3.2</version>
-				<configuration>
-					<source>1.7</source>
-					<target>1.7</target>
-					<fork>true</fork>
-				</configuration>
-			</plugin>
-		</plugins>
-	</build>
-
 	<dependencies>
 		<dependency>
 			<groupId>org.apache.asterix</groupId>
diff --git a/asterix-runtime/pom.xml b/asterix-runtime/pom.xml
index bd89627..0dade16 100644
--- a/asterix-runtime/pom.xml
+++ b/asterix-runtime/pom.xml
@@ -38,16 +38,6 @@
 	<build>
 		<plugins>
 			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>2.3.2</version>
-				<configuration>
-					<source>1.7</source>
-					<target>1.7</target>
-					<fork>true</fork>
-				</configuration>
-			</plugin>
-	      	<plugin>
 	        	<groupId>org.apache.asterix</groupId>
 	        	<artifactId>lexer-generator-maven-plugin</artifactId>
 	        	<version>0.8.7-SNAPSHOT</version>
@@ -184,4 +174,3 @@
 	</dependencies>
 
 </project>
-
diff --git a/asterix-test-framework/pom.xml b/asterix-test-framework/pom.xml
index 9bfe6e8..6ce4bbc 100644
--- a/asterix-test-framework/pom.xml
+++ b/asterix-test-framework/pom.xml
@@ -37,16 +37,6 @@
 	<build>
 		<plugins>
 			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>2.3.2</version>
-				<configuration>
-					<source>1.7</source>
-					<target>1.7</target>
-					<fork>true</fork>
-				</configuration>
-			</plugin>
-			<plugin>
 				<groupId>org.jvnet.jaxb2.maven2</groupId>
 				<artifactId>maven-jaxb2-plugin</artifactId>
 				<version>0.9.0</version>
diff --git a/asterix-tools/pom.xml b/asterix-tools/pom.xml
index 93b43aa..e9c367f 100644
--- a/asterix-tools/pom.xml
+++ b/asterix-tools/pom.xml
@@ -37,16 +37,6 @@
 	<build>
 		<plugins>
 			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>2.3.2</version>
-				<configuration>
-					<source>1.7</source>
-					<target>1.7</target>
-					<fork>true</fork>
-				</configuration>
-			</plugin>
-			<plugin>
 				<artifactId>maven-jar-plugin</artifactId>
 				<version>2.4</version>
 				<executions>
diff --git a/asterix-transactions/pom.xml b/asterix-transactions/pom.xml
index b9a26a0..8f9244c 100644
--- a/asterix-transactions/pom.xml
+++ b/asterix-transactions/pom.xml
@@ -37,16 +37,6 @@
 	<build>
 		<plugins>
 			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>2.3.2</version>
-				<configuration>
-					<source>1.7</source>
-					<target>1.7</target>
-					<fork>true</fork>
-				</configuration>
-			</plugin>
-            <plugin>
                 <groupId>org.apache.asterix</groupId>
                 <artifactId>record-manager-generator-maven-plugin</artifactId>
                 <version>0.8.7-SNAPSHOT</version>
diff --git a/pom.xml b/pom.xml
index 5ff5b35..819f7aa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,6 +45,7 @@
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <jvm.extraargs />
+        <jdk.version>1.8</jdk.version>
         <runSlowAQLTests>false</runSlowAQLTests>
 
     <!-- Definition of tests in various categories which may be excluded -->
@@ -146,6 +147,41 @@
                     </includes>
                 </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>
 
@@ -244,6 +280,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>
 
     <modules>
diff --git a/tlp/pom.xml b/tlp/pom.xml
index 7a77c9c..b3ff069 100644
--- a/tlp/pom.xml
+++ b/tlp/pom.xml
@@ -16,7 +16,6 @@
  ! specific language governing permissions and limitations
  ! under the License.
  !-->
-
 <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.apache</groupId>