1.创建java目录
接着选择java,回车,则创建成功,成功后在左侧栏能看见
2.修改pom.xml文件,(添加依赖)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>books</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<properties>
<!-- jdk版本-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<description>基于Servlet的图书管理系统</description>
<!-- <name>books Maven Webapp</name>-->
<!-- <url>http://maven.apache.org</url>-->
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.26</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<!-- 通过Apache DBUtils来完成数据库的操作 -->
<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
<version>1.6</version>
</dependency>
<!-- 前端页面模板使用的是JSP 那么jstl标签库是必须的 -->
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
</dependency>
<!-- 添加JSON数据的管理工具 FastJSON -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.80</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>books</finalName>
</build>
</project>
请在上方代码中自行修改为你电脑上的mysql版本,以及jdk版本,点击导入,点那个小图标,等一会,就不爆红了。
怎样看是否导入成功,在左侧栏中选择External Libraries,查看是否多了一溜,原来只有两个文件,发现多了表示导入依赖成功!
结束~