[JAVA] To manually deploy Struts2 as a war file

#Purpose Find out how to deploy Struts2 to tomcat without eclipse. Assumption: Class files are compiled

Folder structure

スクリーンショット 2020-02-22 22.54.19.png

If you have a project called Struts2Calc The top page is index.jsp CalcAction.class in controller package CalcFormBean.class in bean package

If there is, it will be as shown in the above figure.

If the class file is in bin or something, create a classes folder like this and move it. struts.xml etc. are also directly under the classes folder.

to war

terminal


cd ~/JavaProjects/Struts2Calc
jar cvf Struts2Calc.war -C WebContent .

So, a war file is created This is tomcat / webapps / Can be deployed by placing it in.

Actually it doesn't have to be war

I wrote to make a war and put it in the webapps folder to deploy to tomcat no matter where I look. It worked even if I took it to webapps as it is without making it a war with the above folder structure as a trial. The identity of the war file is a zip file, and tomcat seems to just unzip it normally. However, it is common sense to use war, so it is usually better to do so.

Recommended Posts

To manually deploy Struts2 as a war file
Deploy a war file on Heroku
Create a Java Servlet and JSP WAR file to deploy to Apache Tomcat 9 in Gradle
How to request a CSV file as JSON with jMeter
SCP transfer War file to Tomcat
How to create a jar file or war file using the jar command
How to read a file and treat it as standard input
[Xcode] How to add a README.md file
War deploy to Azure Web Apps (maven)
Deploy the WEB application by Spring Boot to Tomcat server as WAR
Build by specifying docker as a file
Scraping and writing specific elements to a file
How to deploy a container on AWS Lambda
Write to a file using ShiftJIS-Read a file (Kotlin / JVM)
A story about trying to operate JAVA File
How to deploy
How to run the SpringBoot app as a service
Studying java8 (such as reading a file using Stream)
How to jump from Eclipse Java to a SQL file
How to deploy to Heroku from a local docker image
Item 47: Prefer Collection to Stream as a return type
How to manually generate a JWT with Rails Knock
I want to monitor a specific file with WatchService
What to do when rails creates a 〇〇 2.rb file
How to download a file (Servlet, HTML, Apache, Tomcat)
Spring-Boot-2.3 requires javax.validation to be added as a dependency
How to convert a file to a byte array in Java
Java11: Run Java code in a single file as is