refine code to make it works on new jenkins

Try to refine code to make build works for new jenkins.

I did a try on job http://create-build.intalio.com/view/Build%20Product/job/Cloud-Neocore-AUTO/

and it works well. and it should works for other bpm/pipe jobs, currently I did change directly on slave 3 and Cloud-Neocore-AUTO is also on slave 3. 

Want some review on it and if it's ok we can push it to try more on other slave with this new code. bpm/pipe are running on other slaves.