'Build step 'Deploy war/ear to a container' marked build as failure Finished: FAILURE (Or) ERROR: Build step failed with exception org.codehaus.cargo.c

I was trying to solve this myself, but I haven't been able to solve this issue for three days. I have added user in tomcat-user.xml and tomcat port number is everything looks good, even my tomcat running is fine. But since when I was trying to deploy in tomcat server I am getting this error:

1

2

3



Solution 1:[1]

I was stuck with this problem for some hours and I'm a completely noob in this area. I tried to do it with the "Deploy to container" plugin but for some reason my tomcat server was not picking up.

I tried to change the port number from 8080 to 8084 but still failed.

and that's when I decided to write a script instead of using the plugin. I created a new job with freestyle and under build steps: chose Execute shell.

this is my original code: cp /root/.jenkins/workspace/maven\ package/target/cloudbots_webapp.war /opt/apache-tomcat-9.0.62/webapps

you need to find where the .war file is getting created when you run the package job. view the console and you'll see something called : "Attempting to" above that you'll see that they are trying to copy one file to a different folder.

ex: /file1/ to /file2/

using cp command I entered the directory of both of them and saved it. you also need to change the trigger to run the build after maven package.

Cheers!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user18964851