Fix for proper building using correct version of Java on supported platforms

Change-Id: I9b006d8a2a730c90561210e4e20724a581a672b2
diff --git a/build-debian-packages-jmx-exporter.groovy b/build-debian-packages-jmx-exporter.groovy
index 92bea47..10a2a9a 100644
--- a/build-debian-packages-jmx-exporter.groovy
+++ b/build-debian-packages-jmx-exporter.groovy
@@ -4,11 +4,16 @@
 def dockerLib = new com.mirantis.mk.Docker()
 
 def timestamp = common.getDatetime()
+def javaversion = "8"
 
 node('docker') {
     try {
         def img = dockerLib.getImage("tcpcloud/debian-build-ubuntu-${DIST}")
 
+        if ("${DIST}" == "trusty") {
+        	javaversion = "7"
+        }
+
         img.inside ("-u root:root") {
             sh("rm -rf * || true")
         }
@@ -28,7 +33,7 @@
         img.inside ("-u root:root") {
             stage("Build") {
                 sh("sed -i \"s/TIMESTAMP/${timestamp}/g\" \$(find -name pom.xml)")
-                sh("sudo apt-get update && sudo apt-get install -y openjdk-8-jdk maven")
+                sh("sudo apt-get update && sudo apt-get install -y openjdk-${javaversion}-jdk maven")
                 sh("cd jmx-exporter-${timestamp} && mvn package")
             }
         }