1:首先创建一个空项目,然后创建module
2:在run->Edit Configration 中添加Tomcat,并在deployment中点击**+** 选择Artifact添加进来
3:设置镜像下载所需要spring jar包。
找到IDEA下的plugins->maven->lib->maven3->conf 下的setting.xml文件中
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
然后搜索mvnrepository
需要的jar包配置项,然后在pom.xml中配置。
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>simDemo</artifactId>
<version>1.0-SNAPSHOT</version>
//配置
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.2.9.RELEASE</version>
</dependency>
</dependencies>
</project>
然后在页面上右键****reload project就可以自动下载依赖包了。