You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2018/06/29 11:35:18 UTC

[maven-jenkins-env] branch master updated: Add jdkForMaven and mavenForJdk methods Use reqexp for version matching to reduce repetition

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jenkins-env.git


The following commit(s) were added to refs/heads/master by this push:
     new f4c4734  Add jdkForMaven and mavenForJdk methods Use reqexp for version matching to reduce repetition
f4c4734 is described below

commit f4c4734dad098073b83fd64cfc438ae52765cff3
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Jun 29 13:35:07 2018 +0200

    Add jdkForMaven and mavenForJdk methods
    Use reqexp for version matching to reduce repetition
---
 vars/jenkinsEnv.groovy | 53 +++++++++++++++++++++++++-------------------------
 1 file changed, 27 insertions(+), 26 deletions(-)

diff --git a/vars/jenkinsEnv.groovy b/vars/jenkinsEnv.groovy
index f3f7fa6..933620d 100644
--- a/vars/jenkinsEnv.groovy
+++ b/vars/jenkinsEnv.groovy
@@ -70,47 +70,29 @@ class jenkinsEnv implements Serializable {
         switch (os) {
             case 'linux':
                 switch(version) {
-                    case '3.0.x':
+                    case ~/^3\.0\.[x5]$/:
                         return 'Maven 3.0.5'
-                    case '3.0.5':
-                        return 'Maven 3.0.5'
-                    case '3.2.x':
-                        return 'Maven 3.2.5'
-                    case '3.2.5':
+                    case ~/^3\.2\.[x5]$/:
                         return 'Maven 3.2.5'
-                    case '3.3.x':
-                        return 'Maven 3.3.9'
-                    case '3.3.9':
+                    case ~/^3\.3\.[x9]$/:
                         return 'Maven 3.3.9'
+                    case ~/^3\.5\.[x2]$/:
                     case '3.x.x':
                         return 'Maven 3.5.2'
-                    case '3.5.x':
-                        return 'Maven 3.5.2'
-                    case '3.5.2':
-                        return 'Maven 3.5.2'
                     default:
                         return 'Maven 3.5.2'
                 }
             case 'windows':
                 switch(version) {
-                    case '3.0.x':
+                    case ~/^3\.0\.[x5]$/:
                         return 'Maven 3.0.5 (Windows)'
-                    case '3.0.5':
-                        return 'Maven 3.0.5 (Windows)'
-                    case '3.2.x':
-                        return 'Maven 3.2.5 (Windows)'
-                    case '3.2.5':
+                    case ~/^3\.2\.[x5]$/:
                         return 'Maven 3.2.5 (Windows)'
-                    case '3.3.x':
-                        return 'Maven 3.3.9 (Windows)'
-                    case '3.3.9':
+                    case ~/^3\.3\.[x9]$/:
                         return 'Maven 3.3.9 (Windows)'
+                    case ~/^3\.5\.[x0]$/:
                     case '3.x.x':
                         return 'Maven 3.5.0 (Windows)'
-                    case '3.5.x':
-                        return 'Maven 3.5.0 (Windows)'
-                    case '3.5.2':
-                        return null
                     default:
                         return 'Maven 3.5.0 (Windows)'
                 }
@@ -118,4 +100,23 @@ class jenkinsEnv implements Serializable {
                 return null
         }
     }
+    def jdkForMaven(String version) {
+        switch(version) {
+            case ~/^3\.0\./:
+                return '6'
+            case ~/^3\.[235]\./:
+            case '3.x.x':
+                return '7'
+            default:
+                return null
+        }
+    }
+    def mavenForJdk(String version) {
+        switch(version) {
+            case '6':
+                return '3.0.x'
+            default:
+                return '3.5.x'
+        }
+    }
 }