Repository: maven-integration-testing
Updated Branches:
  refs/heads/master f804183a0 -> ee3cae93c


Auto set source+target to 1.6 when testing with JDK9


Project: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/ee3cae93
Tree: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/ee3cae93
Diff: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/ee3cae93

Branch: refs/heads/master
Commit: ee3cae93ce70f9ff1898b5c10f3cce59898923af
Parents: f804183
Author: Robert Scholte <[email protected]>
Authored: Sat Sep 19 20:50:08 2015 +0200
Committer: Robert Scholte <[email protected]>
Committed: Sat Sep 19 20:50:08 2015 +0200

----------------------------------------------------------------------
 .../it/AbstractMavenIntegrationTestCase.java    | 21 +++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/ee3cae93/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
----------------------------------------------------------------------
diff --git 
a/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
 
b/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
index 36aa888..8966dce 100644
--- 
a/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
+++ 
b/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
@@ -471,13 +471,28 @@ public abstract class AbstractMavenIntegrationTestCase
             {
                 verifier.getSystemProperties().put( 
"org.apache.maven.global-settings", path );
             }
+        }
 
-            if ( matchesVersionRange( "(3.2.5,)" ) )
+        if ( matchesVersionRange( "(3.2.5,)" ) )
+        {
+            verifier.getSystemProperties().put( 
"maven.multiModuleProjectDirectory", basedir );
+        }
+
+        try
+        {
+            // auto set source+target to lowest accepted value based on java 
version
+            // Java9 requires at least 1.6
+            if ( VersionRange.createFromVersionSpec( "[1.9,)" 
).containsVersion( getJavaVersion() ) )
             {
-                verifier.getSystemProperties().put( 
"maven.multiModuleProjectDirectory", basedir );
+                verifier.getSystemProperties().put( "maven.compiler.source", 
"1.6" );
+                verifier.getSystemProperties().put( "maven.compiler.target", 
"1.6" );
             }
         }
-
+        catch ( InvalidVersionSpecificationException e )
+        {
+            // noop
+        }
+        
         return verifier;
     }
 

Reply via email to