With Jenkins 2 Pipeline plugin, there\'s a useful feature allowing a quick overview of the pipeline stages and status of steps, including logging output.
However, if
I was also trying the same thing but in different context, My team don't want multiple sh log window over log UI, so I did try to use multiple UNIX commands in one line
e.g
jenkinsPipeline.sh "echo \"PATH: $PATH\";java -version;echo PROJ DIR = $projectDirectory;env > env.txt;cat env.txt;ls && cd $projectDirectory && gradle --refresh-dependencies clean assemble"
And it worked for Jenkins pipeline script within the Jenkins job.
but if I use shared library for extending pipeline and same strategy, then it was not working or else creating multiple windows as usual for sh log in UI.