瀏覽代碼

HUE-1208 [core] Add safety check to ensure the right JDK is being used

How to specify a 1.7 version for the 'apps' target targets:
MAVEN_OPTIONS="-DjavaVersion=1.7" make apps

Requires Maven 2 instead of 3.
Romain Rigaux 12 年之前
父節點
當前提交
121070af2e

+ 1 - 1
apps/beeswax/java/pom.xml

@@ -109,7 +109,7 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-          <source>1.6</source>
+          <source>${javaVersion}</source>
           <target>${targetJavaVersion}</target>
         </configuration>
       </plugin>

+ 1 - 1
desktop/libs/hadoop/credentials-merger/pom.xml

@@ -53,7 +53,7 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.0</version>
         <configuration>
-          <source>1.6</source>
+          <source>${javaVersion}</source>
           <target>${targetJavaVersion}</target>
         </configuration>
       </plugin>

+ 1 - 1
desktop/libs/hadoop/java/pom.xml

@@ -117,7 +117,7 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.0</version>
         <configuration>
-          <source>1.6</source>
+          <source>${javaVersion}</source>
           <target>${targetJavaVersion}</target>
         </configuration>
         <executions>

+ 1 - 1
desktop/libs/hadoop/sudo-shell/pom.xml

@@ -53,7 +53,7 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.0</version>
         <configuration>
-          <source>1.6</source>
+          <source>${javaVersion}</source>
           <target>${targetJavaVersion}</target>
         </configuration>
       </plugin>

+ 48 - 0
maven/pom.xml

@@ -46,6 +46,7 @@
     <hive.version>0.10.0-cdh4.2.0-SNAPSHOT</hive.version>
     <slf4j.version>1.6.1</slf4j.version>
     <commons-logging.version>1.0.4</commons-logging.version>
+    <javaVersion>1.6</javaVersion>
     <targetJavaVersion>1.6</targetJavaVersion>
   </properties>
 
@@ -61,6 +62,15 @@
   </scm>
 
   <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-enforcer-plugin</artifactId>
+          <version>1.0</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
@@ -70,6 +80,44 @@
           <tagBase>https://svn.apache.org/repos/asf/maven/components/releases</tagBase>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <inherited>false</inherited>
+        <configuration>
+          <rules>
+            <requireMavenVersion>
+              <version>[2.0.0,)</version>
+            </requireMavenVersion>
+            <requireJavaVersion>
+              <version>[${javaVersion}.0,${javaVersion}.1000]</version>
+            </requireJavaVersion>
+          </rules>
+        </configuration>
+        <executions>
+          <execution>
+              <id>clean</id>
+              <goals>
+                  <goal>enforce</goal>
+              </goals>
+              <phase>pre-clean</phase>
+          </execution>
+          <execution>
+              <id>default</id>
+              <goals>
+                  <goal>enforce</goal>
+              </goals>
+              <phase>validate</phase>
+          </execution>
+          <execution>
+              <id>site</id>
+              <goals>
+                  <goal>enforce</goal>
+              </goals>
+              <phase>pre-site</phase>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>