Hi all,I am using a Groovy script to create auto-installers for JDK in my 
Jenkins instance. With a script similar to 
https://stackoverflow.com/questions/55353804/how-to-automate-maven-and-java-jdk8-installation-with-groovy-for-jenkins

This all works and is clear to me but now I want to create a script that 
queries Jenkins for JDKs that are already installed. I can get some of the 
information about installed JDKs but it is unclear how I can retrieve 
properties like the URL to the download JDK tar.gz and the label.

How can I get at that information in my Groovy script?

    import jenkins.model.*
    import hudson.model.*
    import hudson.tasks.*
    import hudson.tools.*
    import java.security.*
    
    def inst = Jenkins.getInstance()
    def desc = inst.getDescriptor("hudson.model.JDK")
    
      desc.getInstallations().each {
        println 'it.getName' + it.getName()
        println 'it.getBinDir' + it.getBinDir()
        println 'it.getExecutable' + it.getExecutable()
        println 'it.getJavaHome' + it.getJavaHome()
        println 'it.getProperties' + it.getProperties() 
//[hudson.tools.InstallSourceProperty@31c527ef]
      }

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f784e7ff-533b-4a51-820b-d42542363b1e%40googlegroups.com.

Reply via email to