Macbook pro M1 builds java web

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)

Insert image description here

2. Fill in the project name

Insert image description here

3. Add the jar package you need (click to open pom.xml)

Insert image description here
提示:这里是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

Insert image description here
Insert image description here

6. You will find that there are more web packages in the directory (jsp html is written in it)

Insert image description here

7. Create the lib directory and add the jar package

Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here

8. Select Add Configuration to add tomcat

Insert image description here

Insert image description here

Insert image description here

提示:第一次配置可能需要配置tomcat目录位置 点开Configure 选择本机所在目录

9. You will find a red warning below. Click fix and it will jump to this page.

Insert image description here

10. Click on the green triangle

Insert image description here

11. It will jump to your computer browser

Insert image description here

Summarize

Maven有静态资源过滤问题 在pom.xml里加build标签就行.

添加lib包 你添加新的依赖进去(jar包,也就是maven的dependency标签)更新里面jar包.

Guess you like

Origin blog.csdn.net/prjh_/article/details/123829503