[workflow-plugin] JAVA_HOME is not defined correctly

922 views
Skip to first unread message

Patrick Bateman

unread,
Mar 16, 2015, 9:27:37 AM3/16/15
to jenkins...@googlegroups.com
Using a script from the plugin demo tailored for my environment, but get a JAVA_HOME error...


Running: Install a tool
Running: Dev
Entering stage Dev
Proceeding
Running: Shell Script
[WPG-TOOLS-WORKFLOW] Running shell script
+ mvn -o clean package
which: no javac in (/opt/jenkins/slave/tools/Maven/apache-maven-3.2.5/bin:/usr/local/bin:/bin:/usr/bin)
which: no java in (/opt/jenkins/slave/tools/Maven/apache-maven-3.2.5/bin:/usr/local/bin:/bin:/usr/bin)
Error: JAVA_HOME is not defined correctly.
  We cannot execute 
Running: Allocate node : Body : End
Running: Allocate node : End
Running: End of Workflow
ERROR: script returned exit code 1
Finished: FAILURE


My workflow script is very simple...

node('slave') {
    git url: '***********************'
    env.PATH="${tool 'Maven 3.2.5'}/bin:${env.PATH}"

    stage 'Dev'
    sh 'mvn -o clean package'

    stage 'QA'
    parallel(SonarQube: {
    })
}

input message: "Does http://localhost:8080/staging/ look good?"
try {
    checkpoint('Before production')
} catch (NoSuchMethodError _) {
    echo 'Checkpoint feature available in Jenkins Enterprise by CloudBees.'
}

My existing Maven jobs work well, but they use Jenkins to define the JDK.

Does this mean that for the Workflow plugin I need to know where Java is installed?

Jesse Glick

unread,
Jun 16, 2015, 2:33:06 PM6/16/15
to jenkins...@googlegroups.com
On Monday, March 16, 2015 at 9:27:37 AM UTC-4, Patrick Bateman wrote:
env.PATH="${tool 'Maven 3.2.5'}/bin:${env.PATH}"

Try adding

env.JAVA_HOME = tool 'JDK 8'

or whatever your preferred JDK installation is called in global configuration.
Reply all
Reply to author
Forward
0 new messages