Deploy with war to tomcat with jenkins - java

I want to deploy my war file after Jenkins build it with Gradle. so I used the deploy plugin. as far as i know i should create a post build action in my task configuration in jenkins. i created that like this:
and I checked that the war file is there.
but its not working and the war is not deployed anywhere and there is no sign of any effort from jenkins to deploy the artifact to the tomcat. here is the console output of my task:
which are all about build actions not post build actions!
anybody can help?
where can i see logs of jenkins post build actions?

it seems like there was a problem with the path to the war file!
although it's relative to ~/.jenkins/jobs/MyJob/workspace/ but it's not working
I changed that to **/*.war and works now!!

Related

How to configure Apache tomcat with Intellij IDEA?

Can someone tell me steps and permissions that are required for running maven project in intellij idea with tomcat to debug server project in windows? I have tried but intellij failed to deploy the war file. I guess there are some certain steps and permissions which I am missing.
Im afraid that you built artifact failed. You can check tomcat's logs in the folder path like:
C:\Users\user\.IntelliJIdea2017.1\system\tomcat\Unnamed_tomcat\logs
Normally, I will create tomcat as below (of course, it run well)
1. Create local tomcat
2. Config tomcat home
Click Configure button, browse to tomcat_home where you installed tomcat
3. add artifact (Deployment tab)
Ok, done. Now you can start tomcat. If building artifact is correct, your application will be up (let's check tomcat's log as I pasted above).

How to create .war file using jenkins for deployment

I started working on Jenkins for continuous integration. My java project is build successfully but am not able to find .war file for deployment. If I manually keep the myproject.war file inside workspace auto deployment is happening in tomcat7.
Now my question: is Jenkins able to create .war or not (if any extra plugins are needed please let me know), or if i need to add any build.xml file where can i keep this file.
Thanks in advance.
Finally i find the solution,
Jenkins is not having a feature like auto creating .war file.
so we have to create build.xml (ANT) for creating .war file.
Keep this file in your project and check-in into the repository.
And map the build.xml location in Jenkins configuration page. When the build is happen through Jenkins it will take the code from repository build it and stores in workspace in Jenkins folder along with .war file.
You can do auto deploy this .war file into your tomcat using Jenkins.

Deploying war file in STS using gradle

I have a web project in STS, that iam looking to deploy in Tomcat. The build file for the project is written in GRADLE. Using GRADLE'S build script, a war file is generated in build/libs.
But STS looks for the war file in workspace/metadata/plugins/org.eclipse.wst.server.core/ folder.
Now If I manually copy the generated WAR file from build/libs to this workspace/metadata/plugins folder, and then start the tomcat, everything works fine but I am not able to debug using breakpoints in STS.
How do I make sure that the war file from build/libs gets moved to workspace/metadata/plugins folder?
And, Why is STS looking to find the war in workspace/metadata/plugins folder. As the app-server is tomcat, should it not be looking in Tomcat/webapps folder to find the war?
I am not a eclipse fan nowadays but did you run eclipse plugin? you can add it to the gradle file
apply plugin: 'eclipse'
and then just run
gradle eclipse
check Eclipse Plugin
I don't believe STS deploys/runs your war file directly. That is, if you select the project and say "Run on Server", STS/eclipse will generate an exploded war to the wtp.deploy directory defined. You can control/alter this by editing the "run configuration" for your server. Just go to the "Arguments" tab and change the setting for the "-Dwtp.deploy".
You should really only use this STS mechanism for development purposes - as it is invaluable for that. To deploy an actual warfile to Tomcat you have a variety of options. You can start a tomcat instance with the manager UI enabled and upload the war file from the Tomcat GUI, you can just manually drop the war file into Tomcat's deployment area, or probably your best option - extend your gradle build scripts to include deploying the generated war file to a tomcat server. Hope this helps some.

Tomcat not uploading all files

When i make the war i see the XCV.Jar, but I add the project on Tomcat (IDE eclipse), and when I deploy it, I have all jars except XCV.Jar (This jar is the parent of the project I deployed).
When you deploy to Tomcat from Eclipse it often fails to clean up the work directory directory. Try to clean $TOMCAT_HOME/work/Catalina// and the web apps directory then try redeploying.
If you are running tomcat inside eclipse you're asking for trouble. Its often better to build and validate the .war independently(with ant or maven) then deploy manually or with a script.

Eclipse and SubClipse: How to deploy my own package with svn to a TomCat server?

I'm using SubClipse for Eclipse for my project.
And in this project I've added my own package "com.mytestpkg.www"
I then use TortoiseSVN to deploy my project on the TomCat server where the project is running, because i the easily can update the site with "SVN Update".
But using this method I always have to manually update my package by copying it from my Eclipse workspace build path to the WEB-INF folder classes/com/mytestpkg/www.
Is there a way to make Subclipse/SVN update this file directly with the other files?
Why don't you do this a more conventional way; e.g.
get Eclipse to create and deploy a WAR file
use Ant or Maven to build the WAR file and deploy it by hand. (The Maven way of building WAR files is really slick!)
Doing a checkout into a Tomcat server's webapps directory is ... weird. And you've got the problem of stopping the world seeing the .svn directories.

Categories