当前位置:网站首页>idea将web项目打包成war包并部署到服务器上运行
idea将web项目打包成war包并部署到服务器上运行
2022-07-03 11:54:00 【陌上桑花开花】
idea将web项目打包成war包并部署到服务器上运行
以下是工作案例总结:
1.首先idea配置服务器:tomcat服务器或者jetty服务器均可

2.idea配置环境设置:点击如下图标


接下来如下操作:
2.1设置project

2.2设置Modules

2.3设置Librabers

2.4设置Facets

2.5设置Artifacts(重点:注意先后顺序,先Exploded后Archive)


具体说明:

补充说明:
Name:是war包的名字,可以自己随意定义
Type:是类型,这里是Archive的类型,也就是war包的类型
Output directory:是war包存储的位置,可以随意修改,找一个好找的位置存储即可
Include in project build:如果把这个选项勾选,说明当当前的这个模块修改了代码或者啥的,重新编译了之后,这个war包也会同步更新修改
Output Layout:是输出布局,也就是war包的目录结构,这里选择了J2SE模块,自然war包最后的结构是和J2SE模块的webapps下的目录结构是一样的。
至于左下角的提示:META-INF/MANIFEST.MF文件没找到也不必理会,这个文件里主要存储了主类,也就是有main方法那个类的所在的位置
2.5设置jdk

3.编译打包:Build Artifacts...----Build


补充说明:
All Artifact:对所有模块进行操作
Build:进行编译打包
Rebuild:重现编译打包,会删除原来的war包,然后编译打包
Clean:清除war包
Edit:重新编辑war包的设置
执行编译后查看编译后war包:

备注:
war包的内容都是从exploded里面复制的,所以如果war包打包发现少东西了,一般都是这个exploded里少了,需要手动粘贴缺少的文件到exploded中,再重新打包。一般我们部署文件到浏览器进行测试的时候,都是部署exploed文件,因为这个文件有着war包一样的目录结构。
4.将war包放到服务器上(tomcat或者jetty服务器)
如何解压war包:如下命令:
unzip -o J2SE.war -d J2SE
更多linux常用命令请查看:Linux常用命令
边栏推荐
- PHP export word method (phpword)
- Sword finger offer03 Repeated numbers in the array [simple]
- PHP get the file list and folder list under the folder
- error: expected reference but got (raw string)
- adb push apk
- 剑指Offer09. 用两个栈实现队列
- wpa_ cli
- (construction notes) learning experience of MIT reading
- init. RC service failed to start
- DEJA_ Vu3d - 054 of cesium feature set - simulate the whole process of rocket launch
猜你喜欢
随机推荐
Use of QT OpenGL camera
Fluent: Engine Architecture
Introduction to concurrent programming (II)
PHP export word method (phpword)
JVM内存模型
Eureka自我保护
Flutter: about monitoring on flutter applications
Computer version wechat applet full screen display method, mobile phone horizontal screen method.
Itext7 uses iexternalsignature container for signature and signature verification
[download attached] password acquisition tool lazagne installation and use
102. Sequence traversal of binary tree
Official website of Unicode query
DEJA_ Vu3d - 054 of cesium feature set - simulate the whole process of rocket launch
If you can't learn, you have to learn. Jetpack compose writes an im app (II)
OpenGL shader use
[combinatorics] permutation and combination (example of permutation and combination)
QT OpenGL texture map
【ManageEngine】IP地址扫描的作用
Flutter Widget : KeyedSubtree
为什么我的mysql容器启动不了呢









