I have created a war file and put into tomcat/webapps
. How to deploy a war file to tomcat using command prompt?
i tried this it works quite well
curl --request PUT --upload-file webapp.war --basic --user user:password \
http://hostname:port/manager/text/deploy?path=/web_path\&update=true
it is based on the published tomcat manager API: https://tomcat.apache.org/tomcat-9.0-doc/manager-howto.html#Deploy_A_New_Application_Archive_(WAR)_Remotely
To do this, we need to place the WAR file inside the Tomcat CATALINA_HOME/WEBAPPS/
directory. Later, Tomcat will automatically deploy and explode this WAR file.
CATALINA_HOME
variable to the path of the Tomcat directorySyntax to copy the WAR file from the current directory in the command line:
copy <your-war-file-name> %CATALINA_HOME%\<your-appBase-name>
Example:
cd C:\MY_WAR_FILE_LOCATION
set CATALINA_HOME="C:\Program Files\Apache\apache-tomcat-7.0.42"
copy MYWARFILE.WAR %CATALINA_HOME%\webapps
Note: If a WAR file is copied into the webapps directory while Tomcat is running, it will not be recognized. Simply restart Tomcat to begin using the web application.