Thanks for the reply, Jesse.
Basically I'm using an Ant installation (existing Ant plugin: 
https://github.com/jenkinsci/ant-plugin/blob/master/src/main/java/hudson/tasks/Ant.java)
 
within my plugin. When I run my plugin, the internal Ant plugin is simply 
using the default JAVA_HOME from my OS.
So, if I understood well, the only way to force this Ant installation to 
use another JAVA_HOME is by resetting the env variable in console before 
starting my Jenkins instance. Is that right?


On Thursday, August 6, 2015 at 10:43:22 PM UTC+2, Jesse Glick wrote:
>
> On Thu, Aug 6, 2015 at 8:28 AM, Rafael Ribeiro Rezende 
> <[email protected] <javascript:>> wrote: 
> > I need to get my JAVA_HOME environment variable from within my 
> MyPublisher 
> > plugin's perform method. So, I do the following: 
> > 
> >          EnvVars env = run.getEnvironment(listener); 
>
> `Run.getEnvironment` produces the environment variables defined for 
> the build as a whole. These are generally quite limited: `BUILD_TAG`, 
> that sort of thing. It will never reflect anything set _within_ the 
> flow, because that is specific to the `StepContext` (consider that you 
> could use `withEnv` inside one branch of a `parallel` step). 
>
> From a `StepExecution`, you would just `@StepContextParameter private 
> EnvVars env;` to get access to the contextual environment variables. 
> This is not available to a `SimpleBuildStep`, however. And that is 
> tracked as: https://issues.jenkins-ci.org/browse/JENKINS-29144 
>

-- 
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/b4d3fe27-20b0-4b72-a938-3df0bd0c5170%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to