See attached screenshot. Please do let me know how to fix this issue ASAP.
You’re talking about
java -classpath /var/lib/jenkins/bin;/var/lib/Jenkins/CYOV3/lib/* org.testng.TestNG testng.xmlas if it were a command, but it’s not — it’s two commands (separated by a
java -classpath /var/lib/jenkins/bin, which causes the long usage/error message from
java, because it’s an incomplete command,
/var/lib/Jenkins/CYOV3/lib/* org.testng.TestNG testng.xml, which globs (does pathname expansion on) the first word (because it contains
*) and expands it to something like
/var/lib/jenkins/CYOV3/lib/bsh-2.0b4.jar /var/lib/Jenkins/CYOV3/lib/foo /var/lib/Jenkins/CYOV3/lib/quux org.testng.TestNG testng.xmlwhich fails because
/var/lib/jenkins/CYOV3/lib/bsh-2.0b4.jar, being a JAR file (and not a script or a binary executable) doesn’t have execute permission.
You need to figure out what you are trying to do, and then do it correctly.
There’s no way an unquoted, unescaped semicolon (
can be part of a command.
Do you want to have a space there?
Or maybe a colon (
Figure it out.
Finally found a fixed. I used the command below and added it as shell command in jenkins job and build it. It is now executing the command. It was found out that it will not work in Openshift/docker ssh termninal due to it has limited permissions unlike in other linux/unix servers. I used colon to separate the two commands.
java -classpath /var/lib/jenkins/bin:/var/lib/Jenkins/CYOV3/lib/* org.testng.TestNG testng.xml
Thanks a lot for everyone who suggested fixes and all advices