Preface
Learn Java web and record it simply
提示:环境 Maven 3.8.14 JDK17 IDEA 2021-3-2 Tomcat 9
1. Specific steps
1. Open the idea, click New and select Maven on the left (no need to select anything, just go to the next step)
2. Fill in the project name
3. Add the jar package you need (click to open pom.xml)
提示:这里是maven仓库地址 里面可以搜索各种 jar包以标签形式添加 https://mvnrepository.com
4. Add this maven resource filter under the pom.xml dependency
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
5. Right click on the project and select web
6. You will find that there are more web packages in the directory (jsp html is written in it)
7. Create the lib directory and add the jar package
8. Select Add Configuration to add tomcat
提示:第一次配置可能需要配置tomcat目录位置 点开Configure 选择本机所在目录
9. You will find a red warning below. Click fix and it will jump to this page.
10. Click on the green triangle
11. It will jump to your computer browser
Summarize
Maven有静态资源过滤问题 在pom.xml里加build标签就行.
添加lib包 你添加新的依赖进去(jar包,也就是maven的dependency标签)更新里面jar包.