5
【笔记】IDEA利用Maven创建Javaweb项目
source link: https://feiju12138.github.io/2022/09/29/IDEA%E5%88%A9%E7%94%A8Maven%E5%88%9B%E5%BB%BAJavaweb%E9%A1%B9%E7%9B%AE/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
【笔记】IDEA利用Maven创建Javaweb项目
2022-09-29
2
IDEA利用Maven创建Javaweb项目
创建一个Maven项目
- 新建项目->
Maven
->选择Java版本->Next
- 指定项目名->
Finish
修改打包方式
- 在
pom.xml
中修改打包方式
<packaging>war</packaging>
修改项目结构
File
->Project Structure
Facets
->+
->Web
- 选择一个模块->
OK
- 选择
Web Module Deployment Descriptor
->点击编辑按钮->将路径改为项目名/src/main/webapp/WEB-INF/web.xml
->OK
- 双击
Web Resource Directory
中的项进行修改->Web resource directory path
将路径改为项目名/src/main/webapp
->OK
->Yes
->OK
手动配置Tomcat运行环境
Add Configuration
->+
->Tomcat Server
->Local
->修改配置名称->指定Tomcat路径
+
->Artifact`
- 选择一个模块->
OK
OK
利用插件配置Tomcat运行环境
<port>80</port>
:配置端口号<path>/</path>
:配置访问路径
pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>80</port>
<path>/</path>
</configuration>
</plugin></plugins>
</build>
Maven
->Plugins
->tomcat7
->tomcat:run
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK