我用的是Intellij IDEA 2021.2.2版本,配的Maven版本为3.9.6版本,创建Maven工程时会报如下错误:解决方法如下:
下载低版本的Maven,这里推荐下载Maven3.6.3版本,下载连接为https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.zip
下载完毕后对该Maven中conf的settings.xml文件进行配置。主要配置仓库、镜像和JKD。
<localRepository>D:\JAVA\Maven\MavenRepositor</localRepository>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
注:不要忘记将环境变量中的Maven路径更改。
最后在IDEA中进行Maven的配置。
更改:Maven home path, User settings file, Local repository