参考:
下载 apache-maven-3.x.x-bin.zip
解压
追加环境变量path
;MAVEN_HOME/bin
不用再设置 M2_HOME 或 MAVEN_HOME 了
mvn -v
测试本地仓库一定要存在需要的jar包
设置本地仓库
<settings>
...
<localRepository>E:\wokesoftware\maven-repository</localRepository>
...
</settings>
<settings>
...
<mirrors>
<mirror>
<id>central</id>
<name>central</name>
<!-- 将镜像地址设置为本地maven地址 -->
<url>file://E:\wokesoftware\maven-repository</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
...
</settings>
常见问题:
Failure to transfer $groupId:$artifactId:pom:$version from $centralUrl was cached in the local repository, resolution will not be reattempted until the update interval of alimaven has elapsed or updates are forced。Original error: Could not transfer artifact $groupId:$artifactId:pom:$version from/to central ($centralUrl):repo.maven.apache.org
解决方案:有可能就是联网的问题