I'm using Jenkins for building & deploying a Java app to Tomcat. I use the deployer plugin to deploy to my Tomcat container. However I have an additional requirement which is - after each deployment I should be able to view the Tomcat log in Jenkins. Is there a way to achieve this? Tomcat & Jenkins are running on different servers.
On *nix, you can use Execute Shell build step to scp files from remote machine back Jenkins's workspace
scp login#remote.server:/path/to/catalina.log ${WORKSPACE}/catalina.log
Once they are in Jenkins workspace, you can just cat them to the console log
cat ${WORKSPACE}/catalina.log
You could then further archive them as any other artifact from workspace
Related
How to deploy a jar file using Jenkins deployment jobs?
Is there any specific plugin available for jar deployments.
For War or EAR, we can go to Jenkins_deployment Jobs >> Post-build Actions >> Deploy war/ear to a container - and provide the below info.
WAR/EAR files,
Context path,
Containers
Can anyone please help in this?
Most containers have a directory where you can "place" the war, in order to deploy it.
Therefore in Jenkins you can set up Send build artifacts over SSH
Name: my_server123 (You must have a configured server)
Transfers: Transfer set:
source files: `path/to/target/*.war
remove prefix: `path/to/target
On configuring the server, you should go in Configure Jenkins -> Configure system -> SSH Servers
Add the server you need to deploy to, username (+password) and Remote directory: /opt/app/tomcat/webapps (or whatever)
If you want to send artifacts from windows build server to linux machine you can use send artifact over ssh from build section
If you want to send artifact from windows build server to windows application server you can use robocopy
Please have a look at the SCP plugin
This plugin uploads build artifacts to repository sites using SCP (SSH) protocol.
I'm looking for a way to be able to deploy war-artifacts to an IntelliJ-started Tomcat when I choose to. I have one project which has a configuration that starts a Tomcat 8 server and deploys some artifacts. LaterI now want to deploy more artifacts from different projects to that same IntelliJ-started Tomcat.
Step: Start project which includes the Tomcat
Step: Deploy war from another IntelliJ-project (from within IDE)
Step: Deploy another war from IntelliJ (from within IDE)
I'm having to solutions in mind but couldn't figure either out:
Maven: so that the war file gets deployed to the tomcat
IntelliJ-Config: that deploys the war file to the already running server
I'm looking for a possibility so that I don't need to take care of the Tomcat myself.
You could always set up a Jenkins instance, and have it build your war every time you push to Git or Subversion, then deploy your war to Tomcat immediately after the build. Just ensure that Jenkins is running off a different port than Tomcat.
I want to deploy a jar file to a remote server and run it. Is there a plugin for maven can do this process? I know that tomcat for maven plugin can deploy the war file to remote server, but my project is not a servlet project. I think the process is that:
1. transfer the jar file to remote server.
2. ran the jar file.
What is a better solution? Thanks!
A combination of these two questions will probably be what you need:
Maven copy local file to remote server using SSH
Run remote command via ssh using Maven3
Does anybody know a gradle 'hot deployment' plugin (or middleware as shell script) which is coping files from source folder directly into project folder at tomcat's webapps directory (not embedded server like gretty or gradle tomcat plugin; version7, environment independent)?
At the end I want to realize a smart dev workflow to (re-, un-) deploy a java web application during code crafting. I'm searching for something like grunt watch tasks.
Scenario: Java web application with self contained, executable jar file at WEB-INF/lib folder.
register watcher tasks on top on gradle task
java source is changed
tomcat stopped
remove jar file at WEB-INF/lib folder
deploy jar file
copy jar into WEB-INF/lib folder
(delete all log files)
start tomcat
Restart tomcat is not needed if static sources are changed (e.g. JSP, JS, ect.).
Solution
I thought about our working practices at the office. My colleagues and I, we program on Windows machines and we use a key map configuration in IDEA to start and stop our local installed Tomcat.
The easiest way for me is to define a user related CATALINA_HOME system environment variable which references the path to Tomcat server.
CATALINA_HOME = C:\Program Files\apache-tomcat-7.0.56
I define a deploy task which copy compiled war file into webapps folder ((re)start Tomcat manually via IEDA).
task deploy(type: Copy) {
def WEBAPPS_HOME = System.getenv()['CATALINA_HOME'] + '/webapps'
from 'build/libs/app.war' into WEBAPPS_HOME
dependsOn war
}
Nobody need to change Tomcat path inside build.gradle file or there is no additional user.config file which is ignored by git.
But I don't like manual Tomcat handling and it is unusual to work with environment variables on Mac's.
So, I decide to search an embedded Tomcat server as Gradle cargo plugin for local development. It is recommanded from Benjamin Muschko (Gradleware Engineer) at How to use local tomcat?... and he describe the differences between Cargo or Tomcat plugin....
Setup of this plugin is quite easy. I don't need to explain.
Nobody need to install there own Tomcat and everybody work with same version server.
For our nigthly build I use the power of Gradle wrapper as Jenkins task configuration.
I execute a wintods batch command.
cd "%WORKSPACE%\app"
gradlew.bat clean build
I use Jenkins to manage deployments for our applications.
There are a number of plugins which help with such tasks along with having the ability to write your own scripts.
Jenkins is highly configurable so you are able to adapt it to your own needs.
Jenkins URL
Hello all master minds,
I have created a java spring application in eclipse with mysql db.
Now I can run this application using >Run on server in eclipse,but I want to know how to deploy this application on my own laptop(windows 7).
I have already configured server,by localhost://8080 I can see Apache tomcat is configured.
Give me simple steps so that i can just run that software using browser via its link like
http://localhost:8080/PMS
PMS is my project name.
Thanks in advance.
You can install tomcat-manager in order to deploy your war using a web interface: Tomcat 7 manager
Another option is to copy your war file into tomcat webapps folder. Your container will auto deploy your war: http://tomcat.apache.org/tomcat-7.0-doc/appdev/deployment.html#Deployment_With_Tomcat.
The easiest way, since you are using eclipse is to just export your project as war and then put that war (naming it PMS) in webapps directory in your tomcat.
Once started, Tomcat will deploy that war on http://localhost:8080/PMS
You have to do the following steps:
Right click on project>> Export (Export as WAR file).
or if you are using a maven project then you can give a maven build.
Copy that WAR file, (you will get that war file inside the project folder in your workspace) to the tomcat_Installed_Folder/ webapps
Inorder to deploy the app from outside eclipse,
goto tomcat_Installed_Folder/bin
and double click on startup.bat
then you could see a console.
For detailed logs of deployment, goto tomcat_Installed_Folder/logs
ALL THE BEST :)