0

I am linux admin and i want to automate the process of java web application deployment process in my client location. And actually they are using svn tool for version control.

So my question is if they commit the​ code into subversion repository automatically create a war file through bash script and move that war file into tomcat for automated deployment.... This is my thought.. can u guys suggest me about war file creation remain process i can build through bash

Thank u in advance

  • a war file is just a zip file, but you can also use maven or any or gradle – Scary Wombat Jun 30 '17 at 04:29
  • You can try Jenkins `https://jenkins.io/` its exactly meant for what you are looking for. It can automatically create war and deploy. Its a part of CI/CD pipeline used in DevOps. You can directly create wars from SVN code and deploy it just with few clicks on jenkins pannel. – Atul Sharma Jun 30 '17 at 04:51

2 Answers2

0

To create war file, you need to use jar tool of JDK. You need to use -c switch of jar, to create the war file.

Go inside the project directory of your project (outside the WEB-INF), then write the following command:

jar -cvf projectname.war * 

Here, -c is used to create file, -v to generate the verbose output and -f to specify the arhive file name.

The * (asterisk) symbol signifies that all the files of this directory (including sub directory).

HSal
  • 35
  • 8
0

There are multiple ways to create WAR file

Using ANT/Maven or many times framework also provides command e.g. Play Framework. You basically need to go to the SVN checkout project folder. if you have ANT or Maven project than follow the steps :

How to create a WAR file using the commandline?

How to create war files

else for other Java based project : To create war file, you need to use jar tool of JDK. You need to use -c switch of jar, to create the war file.

Go inside the project directory of your project (outside the WEB-INF), then write the following command:

jar -cvf projectname.war *

https://www.javatpoint.com/war-file

You can then copy the newly created WAR file to Tomcat webapps folder using linux command SCP or CP.