5

【笔记】IDEA利用Maven创建Javaweb项目

 1 year ago
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.
neoserver,ios ssh client

【笔记】IDEA利用Maven创建Javaweb项目

2022-09-29

2

IDEA利用Maven创建Javaweb项目

创建一个Maven项目

  • 新建项目->Maven->选择Java版本->Next

01.png
  • 指定项目名->Finish

02.png

修改打包方式

  • pom.xml中修改打包方式
<packaging>war</packaging>

修改项目结构

  • File->Project Structure

03.png
  • Facets->+->Web

04.png
  • 选择一个模块->OK

05.png
  • 选择Web Module Deployment Descriptor->点击编辑按钮->将路径改为项目名/src/main/webapp/WEB-INF/web.xml->OK

06.png
  • 双击Web Resource Directory中的项进行修改->Web resource directory path将路径改为项目名/src/main/webapp->OK->Yes->OK

07.png

手动配置Tomcat运行环境

  • Add Configuration->+->Tomcat Server->Local->修改配置名称->指定Tomcat路径

08.png
  • +->Artifact`

09.png
  • 选择一个模块->OK

10.png
  • OK

11.png

利用插件配置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

12.png

哔哩哔哩——黑马程序员


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK