Hello all,

I need to get my JAVA_HOME environment variable from within my MyPublisher 
plugin's perform method. So, I do the following:

@Override
public void perform(Run<?, ?> run, FilePath workspace, Launcher launcher,
        TaskListener listener) throws InterruptedException, IOException {
    
         PublisherLogger logger = new PublisherLogger(listener.getLogger());
         logger.info("Starting the RTC Publisher post-build step.");

         // Get environment variables
         EnvVars env = run.getEnvironment(listener);
         ...
}

My default JAVA_HOME in the OS is
JAVA_HOME=C:\Apps\openjdk-1.7.0.45

I have a single JDK installation in my Jenkins global configuration
Name: Java Tool
JAVA_HOME: C:\tool\java_jdk\1.7.0_60_64

Finally, in my workflow job I have attempted to assign my JAVA_HOME in two 
different ways:
node {

     env.JAVA_HOME = "C:\\tool\\java_jdk\\1.7.0_60_64"
     echo env.JAVA_HOME

     env.JAVA_HOME="${tool 'Java Tool'}"
     echo env.JAVA_HOME

     step([$class: 'MyPublisher',  antName: 'Ant 1.9.2', ...])
     ...
}

The echo commands print the right paths:
Running: Print Message
C:\toolbase\java_jdk\1.7.0_60_64
Running: Install a tool
Running: Print Message
C:\toolbase\java_jdk\1.7.0_60_64

Still, when I debug the *env *variable from the code on top, I see 
JAVA_HOME=C:\Apps\openjdk-1.7.0.45

I'm pretty sure I'm misusing it somehow. But the requirement is so simple 
that I don't know what else to try.
Any help?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" 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-dev/64e382a7-fa76-4cc4-9cc1-e87ccbdb5a87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to