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

11 views
Skip to first unread message

o.v.nenashev@gmail.com (JIRA)

unread,
Dec 2, 2018, 4:12:02 AM12/2/18
to jenkinsc...@googlegroups.com
Oleg Nenashev updated an issue
 
Jenkins / New Feature JENKINS-54959
Offer a new Unarchive installer which takes Java archive structure into account
Change By: Oleg Nenashev
Summary: Automatically installed java set incorrect JAVA_HOME Offer a new Unarchive installer which takes Java archive structure into account
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

legall.benoit@gmail.com (JIRA)

unread,
Dec 3, 2018, 3:37:02 AM12/3/18
to jenkinsc...@googlegroups.com
Benoit Le Gall updated an issue
Change By: Benoit Le Gall
*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

legall.benoit@gmail.com (JIRA)

unread,
Dec 3, 2018, 9:40:07 AM12/3/18
to jenkinsc...@googlegroups.com
Benoit Le Gall commented on New Feature JENKINS-54959
 
Re: Offer a new Unarchive installer which takes Java archive structure into account

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

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

o.v.nenashev@gmail.com (JIRA)

unread,
Dec 3, 2018, 9:46:01 AM12/3/18
to jenkinsc...@googlegroups.com

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

dnusbaum@cloudbees.com (JIRA)

unread,
Dec 4, 2018, 3:09:01 PM12/4/18
to jenkinsc...@googlegroups.com

Yes, this could be useful in some cases, but I do not anticipate having any time to work on this plugin, although if you open a PR to add the feature, I will be happy to review it.

dbeck@cloudbees.com (JIRA)

unread,
Dec 5, 2018, 6:12:02 AM12/5/18
to jenkinsc...@googlegroups.com

Weird, I thought the unzip installers removed a top level directory if there's only one.

dbeck@cloudbees.com (JIRA)

unread,
Dec 5, 2018, 7:37:03 AM12/5/18
to jenkinsc...@googlegroups.com

legall.benoit@gmail.com (JIRA)

unread,
Dec 5, 2018, 8:31:04 AM12/5/18
to jenkinsc...@googlegroups.com

Optional subdirectory of the downloaded and unpacked archive to use as the tool's home directory

isn't the opposite that we want ? no subdirectory ?

dbeck@cloudbees.com (JIRA)

unread,
Dec 5, 2018, 8:37:02 AM12/5/18
to jenkinsc...@googlegroups.com

legall.benoit@gmail.com (JIRA)

unread,
Dec 5, 2018, 9:27:02 AM12/5/18
to jenkinsc...@googlegroups.com

ha ! I've finally understood ! I first understood that it add a subdirectory to the final path...
Yes, it's was it does, so now the JAVA_HOME is correctly set.
But still, I had to open the archive to know what the inner directory was, not very friendly use
...

so now, I just have the following error :

/var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Default/bin/mvn: exec: line 199: /var/jenkins_home/tools/hudson.model.JDK/Java_10/jdk-10.0.2/bin/java: not found

event if the java file is present
I will update the SO question with all this.

Thanks a lot

dbeck@cloudbees.com (JIRA)

unread,
Dec 5, 2018, 9:31:03 AM12/5/18
to jenkinsc...@googlegroups.com

dbeck@cloudbees.com (JIRA)

unread,
Dec 5, 2018, 9:31:03 AM12/5/18
to jenkinsc...@googlegroups.com

dbeck@cloudbees.com (JIRA)

unread,
Dec 5, 2018, 9:31:04 AM12/5/18
to jenkinsc...@googlegroups.com
 
Re: Offer a new Unarchive installer which takes Java archive structure into account

Reducing priority due to workaround/alternative present.

legall.benoit@gmail.com (JIRA)

unread,
Dec 5, 2018, 10:26:02 AM12/5/18
to jenkinsc...@googlegroups.com

as it is a automatic installed jdk, it's on the java_home volume for the container. There is no specifics rights/permissions set as I have installed following the documentation.
Here is what I have

root@vps536376:~# ls /var/lib/docker/volumes/jenkins_home/_data/tools/hudson.model.JDK/Java_10/jdk-10.0.2/bin/
appletviewer  jar        javac    jcmd      jdeprscan  jimage  jlink  jps         jstack  keytool  rmic         schemagen   tnameserv  wsimport
idlj          jarsigner  javadoc  jconsole  jdeps      jinfo   jmap   jrunscript  jstat   orbd     rmid         serialver   unpack200  xjc
jaotc         java       javap    jdb       jhsdb      jjs     jmod   jshell      jstatd  pack200  rmiregistry  servertool  wsgen
root@vps536376:~# docker volume inspect jenkins_home
[
    {
        "CreatedAt": "2018-12-05T15:41:37+01:00",
        "Driver": "local",
        "Labels": null,
        "Mountpoint": "/var/lib/docker/volumes/jenkins_home/_data",
        "Name": "jenkins_home",
        "Options": null,
        "Scope": "local"
    }
]
root@vps536376:~# 

legall.benoit@gmail.com (JIRA)

unread,
Dec 5, 2018, 10:28:03 AM12/5/18
to jenkinsc...@googlegroups.com
Benoit Le Gall edited a comment on New Feature JENKINS-54959
as it is a automatic installed jdk, it's on the java_home volume for the container. There is no specifics rights/permissions set as I have installed following the documentation.
Here is what I have

{code:bash}

root@vps536376:~# ls /var/lib/docker/volumes/jenkins_home/_data/tools/hudson.model.JDK/Java_10/jdk-10.0.2/bin/
appletviewer  jar        javac    jcmd      jdeprscan  jimage  jlink  jps         jstack  keytool  rmic         schemagen   tnameserv  wsimport
idlj          jarsigner  javadoc  jconsole  jdeps      jinfo   jmap   jrunscript  jstat   orbd     rmid         serialver   unpack200  xjc
jaotc         java       javap    jdb       jhsdb      jjs     jmod   jshell      jstatd  pack200  rmiregistry  servertool  wsgen
root@vps536376:~# docker volume inspect jenkins_home
[
    {
        "CreatedAt": "2018-12-05T15:41:37+01:00",
        "Driver": "local",
        "Labels": null,
        "Mountpoint": "/var/lib/docker/volumes/jenkins_home/_data",
        "Name": "jenkins_home",
        "Options": null,
        "Scope": "local"
    }
]
root@vps536376:~#

root@vps536376:~# ls -l /var/lib/docker/volumes/jenkins_home/_data/tools/hudson.model.JDK/Java_10/jdk-10.0.2/bin/
total 592
-rwxr-xr-x 1 root ubuntu   9920 Jun 28 02:54 appletviewer
-rwxr-xr-x 1 root ubuntu   9864 Jun 28 02:54 idlj
-rwxr-xr-x 1 root ubuntu  11112 Jun 28 02:54 jaotc
-rwxr-xr-x 1 root ubuntu   9864 Jun 28 02:54 jar
-rwxr-xr-x 1 root ubuntu   9872 Jun 28 02:54 jarsigner
-rwxr-xr-x 1 root ubuntu   9056 Jun 28 02:54 java
...
{code}

legall.benoit@gmail.com (JIRA)

unread,
Dec 5, 2018, 10:28:03 AM12/5/18
to jenkinsc...@googlegroups.com

legall.benoit@gmail.com (JIRA)

unread,
Dec 5, 2018, 11:06:02 AM12/5/18
to jenkinsc...@googlegroups.com

brunojcm@gmail.com (JIRA)

unread,
Aug 3, 2019, 5:37:02 AM8/3/19
to jenkinsc...@googlegroups.com

brunojcm@gmail.com (JIRA)

unread,
Aug 3, 2019, 5:39:01 AM8/3/19
to jenkinsc...@googlegroups.com
Bruno Medeiros commented on New Feature JENKINS-54959
 
Re: Offer a new Unarchive installer which takes Java archive structure into account

It seems that setting the "Subdirectory of extracted archive" of the JDK tool configuration is a valid workaround:

brunojcm@gmail.com (JIRA)

unread,
Aug 3, 2019, 5:40:03 AM8/3/19
to jenkinsc...@googlegroups.com
Bruno Medeiros updated an issue
Change By: Bruno Medeiros
Comment:
It seems that setting the "Subdirectory of extracted archive" of the JDK tool configuration is a valid workaround:

!screenshot-1.png|width=485,height=177,thumbnail!

hostalp@post.cz (JIRA)

unread,
Oct 15, 2019, 8:21:04 PM10/15/19
to jenkinsc...@googlegroups.com
Petr H commented on New Feature JENKINS-54959
 
Re: Offer a new Unarchive installer which takes Java archive structure into account
  • automatically installed JDK (when it worked):
    hudson.model.JDK/JDK8u152/bin/
  • manually downloaded and locally used binary archive (jdk-8u212-linux-x64.tar.gz in this example):
    hudson.model.JDK/JDK8/jdk1.8.0_212/bin/
    Although I can set the Subdirectory of extracted archive to "jdk1.8.0_212" (for the above example) which sets the java home correctly, I'd like to get the same result as with the automatically installed JDK - e.g. without that additional subdirectory.
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

hostalp@post.cz (JIRA)

unread,
Oct 15, 2019, 8:23:02 PM10/15/19
to jenkinsc...@googlegroups.com
Petr H edited a comment on New Feature JENKINS-54959
- automatically installed JDK (when it worked):
hudson.model.JDK/JDK8u152/bin/
- manually downloaded and locally used binary archive (jdk-8u212-linux-x64.tar.gz in this example):
hudson.model.JDK/JDK8/*jdk1.8.0_212*/bin/

Although I can set the *Subdirectory of extracted archive* to "jdk1.8.0_212" (for the above example) which sets the java home correctly, I'd like to get the same result as with the automatically installed JDK - e.g. without that additional subdirectory.

hostalp@post.cz (JIRA)

unread,
Oct 15, 2019, 8:24:03 PM10/15/19
to jenkinsc...@googlegroups.com
Petr H edited a comment on New Feature JENKINS-54959
- automatically installed JDK (when it worked):
hudson.model.JDK/JDK8u152/bin/
- manually downloaded and locally used binary archive (jdk-8u212-linux-x64.tar.gz in this example):
hudson.model.JDK/JDK8/*jdk1.8.0_212*/bin/

Although I can set the *Subdirectory of extracted archive* to "jdk1.8.0_212" (for the above example) which sets the java home correctly, I'd like to get the same result as with the automatically installed JDK - e.g. without that additional subdirectory in the filesystem path .
Reply all
Reply to author
Forward
0 new messages