

- Git change branch tomcat how to#
- Git change branch tomcat install#
- Git change branch tomcat registration#
- Git change branch tomcat code#
Now, we will write the ansible roles to do all the tasks and configure it to run inside a Jenkins job Ansible Playbook
Git change branch tomcat install#
Previously, we used to install tomcat and java manually on the server and then copy the war file under webapps folder and restart the service. Now we have generated the war file and we can deploy it on our tomcat server. Clone the git repo and run the mvn command, this will generate a war file under target folder git clone Compile and package the project using MavenĬreated a pom.xml file to compile and package the project in war file.
Git change branch tomcat registration#
Create a pipeline job in Jenkins and trigger the buildįirstly, create a sample registration and login page in jsp.Deploy the war file on tomcat server using ansible playbook.Create a role in Ansible to install java and tomcat.Make sure ssh connection is already setup between for jenkins user between two AWS EC2 Instances.Integration between Jenkins and Ansible.Follow Jenkins Installation article if not already installed.Two AWS EC2 instance ( one is Jenkins Server and another is tomcat server).If you want to see the video for this article, click here Prerequisite: At last,this process will help us in achieving continuous integration and continuous deployment for your application. We will deploy the sample java application using Ansible on the tomcat servers.

Git change branch tomcat code#
If you don’t care about file history then that works just fine but don’t come crying to me when you try to track down why a certain line of code was added.In this blog, we will explore the CI/CD process using Jenkins and Ansible. Now I used Liferay’s Github repository as example but at Liferay when we move things around we always do it with plain copy followed by massive commit that looses all history. The only thing is that it has to be merged and can’t be rebased. Now you are ready to merge it to master or send a pull request to someone who will merge it. I’m assuming that it is next to the tmp-plugins-repo. Now you need to clone the liferay-portal repository if you haven’t done it yet. Pull the akismet-portlet from liferay-plugins to liferay-portal repository Now the files are in their right place and the changes have been committed to the repository.Ĥ. Git commit -a "Moved akismet-portlet to modules/apps/akismet/akismet-portlet" Git mv -k * modules/apps/akismet/akismet-portlet mkdir -p modules/apps/akismet/akismet-portlet Next we need to move the files to the path they are going to be in the liferay-portal repository which is under modules/apps/akismet. Move the project to it’s new path in the new repository

When you’ve ran the the git filter-branch you’ll notice that the files from portlets/akismet-portlet are now in the root and nothing else in the repository appears to exist.ģ. Git filter-branch -subdirectory-filter portlets/akismet-portlet -all Word of warning if you skipped step one go back to it since this is destructive operation. In this step we’ll checkout the branch from which we want to move the project and then we’ll rewrite the branch so that it only contains commits to the project we want to move. Extract the akismet-portlet and it’s history git clone :liferay/liferay-plugins.git tmp-plugins-repoĢ. There is a way to recover though I learned that the hard way. It’s important to create a fresh clone of the repository as what we are about to do to it will make it unusable. This example assumes you are working with the master branch but the same steps works with any branch. So we’ll use some git magic to pull the akismet-portlet into the new path under liferay-portal repository. We could simply copy it there but then we would loose the whole history of that project. The akismet-portlet is currently under portlets in the liferay-plugins repository. Lets assume as we are modularizing things we want to move the akismet-portlet plugin from liferay-plugins repository to liferay-portal repository under modules/apps/akismet. We have two repositories liferay-portal and liferay-plugins which are both hosted on Github. So I’m going to use Liferay as the example for this so that it’s as clear as it can be. So I wanted to write clear instructions for the next time I have to do this and hopefully it also helps someone else.
Git change branch tomcat how to#
This is rather easy once you know how to do it but you can easily jack up things if you don’t know. I recently had to move a project from one git repository to another existing repository under different source tree and I wanted to retain the history of each file.
