当前位置:网站首页>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常用命令
边栏推荐
- Integer int compare size
- Pragma pack syntax and usage
- (构造笔记)ADT与OOP
- Itext7 uses iexternalsignature container for signature and signature verification
- Qt+vtk+occt reading iges/step model
- 使用BLoC 构建 Flutter的页面实例
- adb push apk
- Flutter: about monitoring on flutter applications
- C language improvement article (wchar_t) character type
- How to deploy web pages to Alibaba cloud
猜你喜欢

剑指Offer10- I. 斐波那契数列

2.8 overview of ViewModel knowledge

Self made pop-up input box, input text, and click to complete the event.

Socket TCP for network communication (I)

Eureka self protection

Symlink(): solution to protocol error in PHP artisan storage:link on win10

QT OpenGL texture map

Use bloc to build a page instance of shutter

Take you to the installation and simple use tutorial of the deveco studio compiler of harmonyos to create and run Hello world?

Talk about the state management mechanism in Flink framework
随机推荐
Redis notes 01: Introduction
init. RC service failed to start
[ManageEngine] the role of IP address scanning
242. Effective letter heteronyms
(构造笔记)ADT与OOP
Use bloc to build a page instance of shutter
ES6新特性
SLF4J 日志门面
Eureka self protection
实现验证码验证
Redis
Apprendre à concevoir des entités logicielles réutilisables à partir de la classe, de l'API et du cadre
OpenGL shader use
Talk about the state management mechanism in Flink framework
2020-11_ Technical experience set
Shardingsphere sub database and sub table < 3 >
4000字超详解指针
写一个简单的nodejs脚本
QT OpenGL rotate, pan, zoom
剑指Offer07. 重建二叉树