国内访问中央仓库比较慢,所以一般用国内的,目前我一直用的都是阿里云的仓库,这里我只修改了当前项目仓库,在pom中增加如下:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14<repositories> <repository> <id>nexus-aliyun</id> <name>Nexus aliyun</name> <layout>default</layout> <url>http://maven.aliyun.com/nexus/content/groups/public</url> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> </repositories>
但是有时候还是会有插件找不到的,如果出现该问题的朋友可以增加如下代码,可以解决
Could not find artifact org.springframework.boot:spring-boot-maven-plugin:pom:2.2.5.RELEASE in alimaven spring plugin (https://maven.aliyun.com/repository/spring-plugin)
的问题,plugin要专门配置,也是坑的不行:
复制代码
1
2
3
4
5
6
7<pluginRepositories> <pluginRepository> <id>alimaven spring plugin</id> <name>alimaven spring plugin</name> <url>https://maven.aliyun.com/repository/spring-plugin</url> </pluginRepository> </pluginRepositories>
欢迎各位补坑,特别是自己从头搭建新项目时候的坑。
如果还是不行,再试试下一步,因为我用的是idea,所以直接修改idea的Maven配置,我采用的是idea的默认Maven配置,配置文件的地址是IntelliJ IDEA 2019.2pluginsmavenlibmaven3conf 下面的settings文件,再mirrors节点下增加如下代码:
复制代码
1
2
3
4
5
6<mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror>
之后clean项目,应该就彻底好了,到这一步如果你还是不行(其实我的就不行),重启idea就可以了,红线消失,完美。
最后
以上就是跳跃黑猫最近收集整理的关于Maven国内仓库(mvn修改单个项目仓库)的全部内容,更多相关Maven国内仓库(mvn修改单个项目仓库)内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复