之前开发java的时候就踩了一个大坑,连maven都装不好,依赖也下了不了还怎么开发?
其实只需要配置好镜像源和jdk就好了,少走弯路。
新版的idea都有自带maven,也可以直接走 C:\Users\user\.m2去配置文件用,可能更方便。
我这边还是自己下载了一个maven,走的是idea配置:
1.打开maven的设置
2.配置需要注意的一个坑,不仅要配置镜像,还要调整仓库地址。
目录参考:
3.配置maven镜像和jdk
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
<!-- 这里是你仓库的地址 -->
<localRepository>D:\maven\maven-repository</localRepository>
<mirrors>
<mirror>
<id>maven-public</id>
<mirrorOf>*</mirrorOf>
<name>Aliyun Maven Public</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
<mirror>
<id>maven-central</id>
<mirrorOf>central</mirrorOf>
<name>Aliyun Maven Central</name>
<url>https://maven.aliyun.com/repository/central</url>
</mirror>
</mirrors>
<profiles>
<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>
<profile>
<id>jdk-17</id>
<activation>
<jdk>17</jdk>
</activation>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.compilerVersion>17</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
</settings>