fetching parameters from a jenkins job in java code -


i have parameterised jenkins job accessing plugin. inside plugin's code in java, require these parameters using have trigger job in jenkins. not able fetch these parameters , high priority issue now. ahve tried multiple solutions available on stackoverflow, eg., tried accessing environment variables didn't received param's value. e.g., parameter 'repos' , need value, have tried :

system.getproperty("repos"); 

but returns null.

also, tried :

map<string, string> env = system.getenv();               (string envname : env.keyset()) {                   system.out.format("%s=%s%n", envname, env.get(envname));               } 

but prints jenkins' environment variables , not job's parameters.

i referring value passed in text box beside param: "url" in below picture.

enter image description here

please assist.

to best of knowledge, jenkins parameters exposed environment variables. however, if use build system maven launches java sub-processes, variables might not inherited.

probably reliable approach explicitly pass parameters system properties in jenkins configuration, eg -drepos=${repos}


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -