墙内maven深坑之一定要配置全局设置(Global Settings)

如果不配置这个,就会导致你的pom.xml文件第一行报错。

尽管你在你的项目中配置了阿里云镜像!

错误内容大多如下。

Failure to find org.springframework.boot:spring-boot-maven-plugin:jar:2.2.5.RELEASE in http://repo.maven.apache.org/maven2 was cached in the local repository, 
 resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced

意思是让你强制更新。

墙内maven深坑之一定要配置全局设置(Global Settings)_第1张图片

然而并没有什么卵用,仍然会报错。这个时候你就应该去检查你的

镜像

直接在pom.xml文件内加入这个即可

    
        
            nexus-aliyun
            Nexus aliyun
            http://maven.aliyun.com/nexus/content/groups/public
        

    

第二步,找到你的maven配置文件,里面的镜像改成如下配置。

 
   
   
   
        nexus-aliyun
        central
        Nexus aliyun
        http://maven.aliyun.com/nexus/content/groups/public
   

 

第三步,在你的STS或者是Eclipse中,更改maven的全局配置。

墙内maven深坑之一定要配置全局设置(Global Settings)_第2张图片

最后,在你的项目上右键->maven->update project->记得勾选强制更新。

此时报错就会消失。

需要注意的是,你的User Settings最好也和你的Global Settings保持相同的文件,以免出现意外情况,比如你的全局设置里面有配置阿里云,用户设置却没有。

你可能感兴趣的:(墙内maven深坑之一定要配置全局设置(Global Settings))