Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-54959

Offer a new Unarchive installer which takes Java archive structure into account

      Jenkins installation
      Installed from docker image jenkinsci/docker - README.me

      Plugins
      Pipeline Maven Plugin

      Configuration - configureTools

      1. JDK :
      2. Maven :
        • name : Default
        • install automatically : true (Install from Apache)
        • version : 3.6.0

      Jenkinsfile
       

      pipeline {
          agent any
      
          stages {
              stage('Clean') {
                  steps {
                      withMaven(maven: 'Default',jdk: 'Java 10') {
                          sh "echo JAVA_HOME=$JAVA_HOME"
                          sh "mvn clean"
                      }
                  }
              }
          }
      }
      

      Error

      [Pipeline] // stage
      [Pipeline] withEnv
      [Pipeline] {
      [Pipeline] stage
      [Pipeline]\{ (Clean)
      [Pipeline] withMaven
      [withMaven] Options: []
      [withMaven] Available options:
      [withMaven] using JDK installation Java 10
      [withMaven] using Maven installation 'Default' [Pipeline] {
      [Pipeline] sh
      + echo 'JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10'
      JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10
      [Pipeline] sh
      + mvn clean -B -V
      ----- withMaven Wrapper script -----
      The JAVA_HOME environment variable is not defined correctly
      This environment variable is needed to run this program
      NB: JAVA_HOME should point to a JDK not a JRE
      [Pipeline] }
      

      Actual
      JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10

      Expected
      JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10/jdk-10.0.2

      Looks like the automatic set JEVA_HOME is missing the last part of the path

          [JENKINS-54959] Offer a new Unarchive installer which takes Java archive structure into account

          Benoit Le Gall created issue -
          Benoit Le Gall made changes -
          Description Original: *Jenkins installation*
          Installed from docker image [jenkinsci/docker - README.me|https://github.com/jenkinsci/docker/blob/master/README.md]

          *Configuration - configureTools*
           # JDK :
           ** name : Java 10
           ** install automatically : true (extract *.zip/*.tar.gz)
           ** url : [https://download.java.net/java/GA/jdk10/10.0.2/19aef61b38124481863b1413dce1855f/13/openjdk-10.0.2_linux-x64_bin.tar.gz]
           # Maven :
           ** name : Default
           ** install automatically : true (Install from Apache)
           ** version : 3.6.0

          *Jenkinsfile*
           {code:groovy}
          pipeline {
              agent any

              stages {
                  stage('Clean') {
                      steps {
                          withMaven(maven: 'Default',jdk: 'Java 10') {
                              sh "echo JAVA_HOME=$JAVA_HOME"
                              sh "mvn clean"
                          }
                      }
                  }
              }
          }
          {code}

          *Error*
          {noformat}
          [Pipeline] // stage
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] stage
          [Pipeline]\{ (Clean)
          [Pipeline] withMaven
          [withMaven] Options: []
          [withMaven] Available options:
          [withMaven] using JDK installation Java 10
          [withMaven] using Maven installation 'Default' [Pipeline] {
          [Pipeline] sh
          + echo 'JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10'
          JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10
          [Pipeline] sh
          + mvn clean -B -V
          ----- withMaven Wrapper script -----
          The JAVA_HOME environment variable is not defined correctly
          This environment variable is needed to run this program
          NB: JAVA_HOME should point to a JDK not a JRE
          [Pipeline] }
          {noformat}

          *Actual*
           _JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10_

          *Expected*
           _JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10/*jdk-10.0.2*_

          Looks like the automatic set JEVA_HOME is missing the last part of the path
          New: *Jenkins installation*
          Installed from docker image [jenkinsci/docker - README.me|https://github.com/jenkinsci/docker/blob/master/README.md]

          *Plugins*
          [Pipeline Maven Plugin|https://wiki.jenkins.io/display/JENKINS/Pipeline+Maven+Plugin]

          *Configuration - configureTools*
           # JDK :
           ** name : Java 10
           ** install automatically : true (extract *.zip/*.tar.gz)
           ** url : [https://download.java.net/java/GA/jdk10/10.0.2/19aef61b38124481863b1413dce1855f/13/openjdk-10.0.2_linux-x64_bin.tar.gz]
           # Maven :
           ** name : Default
           ** install automatically : true (Install from Apache)
           ** version : 3.6.0

          *Jenkinsfile*
           {code:groovy}
          pipeline {
              agent any

              stages {
                  stage('Clean') {
                      steps {
                          withMaven(maven: 'Default',jdk: 'Java 10') {
                              sh "echo JAVA_HOME=$JAVA_HOME"
                              sh "mvn clean"
                          }
                      }
                  }
              }
          }
          {code}

          *Error*
          {noformat}
          [Pipeline] // stage
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] stage
          [Pipeline]\{ (Clean)
          [Pipeline] withMaven
          [withMaven] Options: []
          [withMaven] Available options:
          [withMaven] using JDK installation Java 10
          [withMaven] using Maven installation 'Default' [Pipeline] {
          [Pipeline] sh
          + echo 'JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10'
          JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10
          [Pipeline] sh
          + mvn clean -B -V
          ----- withMaven Wrapper script -----
          The JAVA_HOME environment variable is not defined correctly
          This environment variable is needed to run this program
          NB: JAVA_HOME should point to a JDK not a JRE
          [Pipeline] }
          {noformat}

          *Actual*
           _JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10_

          *Expected*
           _JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10/*jdk-10.0.2*_

          Looks like the automatic set JEVA_HOME is missing the last part of the path

          Oleg Nenashev added a comment -

          "Unzip" tool installer does not know anything specific about Java or any other tool. It just unpacks the archive to a tool cache and then sets home to the root of the archive. So it's not a bug.

          In this case it might be helpful to create a new version of the installer in the JDK Tool Plugin. It can be done by copying or extending the https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java in the plugin

          CC dnusbaum who maintains the plugin now

           

           

           

          Oleg Nenashev added a comment - "Unzip" tool installer does not know anything specific about Java or any other tool. It just unpacks the archive to a tool cache and then sets home to the root of the archive. So it's not a bug. In this case it might be helpful to create a new version of the installer in the JDK Tool Plugin. It can be done by copying or extending the https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java  in the plugin CC dnusbaum who maintains the plugin now      
          Oleg Nenashev made changes -
          Component/s New: jdk-tool-plugin [ 23529 ]
          Oleg Nenashev made changes -
          Issue Type Original: Bug [ 1 ] New: New Feature [ 2 ]
          Oleg Nenashev made changes -
          Summary Original: Automatically installed java set incorrect JAVA_HOME New: Offer a new Unarchive installer which takes Java archive structure into account
          Benoit Le Gall made changes -
          Description Original: *Jenkins installation*
          Installed from docker image [jenkinsci/docker - README.me|https://github.com/jenkinsci/docker/blob/master/README.md]

          *Plugins*
          [Pipeline Maven Plugin|https://wiki.jenkins.io/display/JENKINS/Pipeline+Maven+Plugin]

          *Configuration - configureTools*
           # JDK :
           ** name : Java 10
           ** install automatically : true (extract *.zip/*.tar.gz)
           ** url : [https://download.java.net/java/GA/jdk10/10.0.2/19aef61b38124481863b1413dce1855f/13/openjdk-10.0.2_linux-x64_bin.tar.gz]
           # Maven :
           ** name : Default
           ** install automatically : true (Install from Apache)
           ** version : 3.6.0

          *Jenkinsfile*
           {code:groovy}
          pipeline {
              agent any

              stages {
                  stage('Clean') {
                      steps {
                          withMaven(maven: 'Default',jdk: 'Java 10') {
                              sh "echo JAVA_HOME=$JAVA_HOME"
                              sh "mvn clean"
                          }
                      }
                  }
              }
          }
          {code}

          *Error*
          {noformat}
          [Pipeline] // stage
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] stage
          [Pipeline]\{ (Clean)
          [Pipeline] withMaven
          [withMaven] Options: []
          [withMaven] Available options:
          [withMaven] using JDK installation Java 10
          [withMaven] using Maven installation 'Default' [Pipeline] {
          [Pipeline] sh
          + echo 'JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10'
          JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10
          [Pipeline] sh
          + mvn clean -B -V
          ----- withMaven Wrapper script -----
          The JAVA_HOME environment variable is not defined correctly
          This environment variable is needed to run this program
          NB: JAVA_HOME should point to a JDK not a JRE
          [Pipeline] }
          {noformat}

          *Actual*
           _JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10_

          *Expected*
           _JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10/*jdk-10.0.2*_

          Looks like the automatic set JEVA_HOME is missing the last part of the path
          New: *Jenkins installation*
          Installed from docker image [jenkinsci/docker - README.me|https://github.com/jenkinsci/docker/blob/master/README.md]

          *Plugins*
          [Pipeline Maven Plugin|https://wiki.jenkins.io/display/JENKINS/Pipeline+Maven+Plugin]

          *Configuration - configureTools*
           # JDK :
           ** name : Java 10
           ** install automatically : true (extract .zip/.tar.gz)
           ** url : [https://download.java.net/java/GA/jdk10/10.0.2/19aef61b38124481863b1413dce1855f/13/openjdk-10.0.2_linux-x64_bin.tar.gz]
           # Maven :
           ** name : Default
           ** install automatically : true (Install from Apache)
           ** version : 3.6.0

          *Jenkinsfile*
           {code:groovy}
          pipeline {
              agent any

              stages {
                  stage('Clean') {
                      steps {
                          withMaven(maven: 'Default',jdk: 'Java 10') {
                              sh "echo JAVA_HOME=$JAVA_HOME"
                              sh "mvn clean"
                          }
                      }
                  }
              }
          }
          {code}

          *Error*
          {noformat}
          [Pipeline] // stage
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] stage
          [Pipeline]\{ (Clean)
          [Pipeline] withMaven
          [withMaven] Options: []
          [withMaven] Available options:
          [withMaven] using JDK installation Java 10
          [withMaven] using Maven installation 'Default' [Pipeline] {
          [Pipeline] sh
          + echo 'JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10'
          JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10
          [Pipeline] sh
          + mvn clean -B -V
          ----- withMaven Wrapper script -----
          The JAVA_HOME environment variable is not defined correctly
          This environment variable is needed to run this program
          NB: JAVA_HOME should point to a JDK not a JRE
          [Pipeline] }
          {noformat}

          *Actual*
           _JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10_

          *Expected*
           _JAVA_HOME=/var/jenkins_home/tools/hudson.model.JDK/Java_10/*jdk-10.0.2*_

          Looks like the automatic set JEVA_HOME is missing the last part of the path

          Question: why isn't a default installer for open-jdk ?

          Cause there is a plugin, but no more upgraded (openJDK-native-plugin) :/

          Benoit Le Gall added a comment - Question: why isn't a default installer for open-jdk ? Cause there is a plugin, but no more upgraded ( openJDK-native-plugin ) :/

          Oleg Nenashev added a comment -

          Historical reasons. I believe that part of the code was originally written for Sun JVMs, maybe before OpenJDK was formalized and established

          Oleg Nenashev added a comment - Historical reasons. I believe that part of the code was originally written for Sun JVMs, maybe before OpenJDK was formalized and established

            Unassigned Unassigned
            legall_benoit Benoit Le Gall
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: