maven-surefire-plugin:2.22.1 or one of its dependencies could not be resolved

有时候使用maven打包时会出现如下:

[ERROR] Plugin org.apache.maven.plugins:maven-surefire-plugin:2.22.1 or one of its dependencies could not be resolved: Cannot access nexus (http://maven.aliyun.com/nexus/content/groups/public) in offline mode and the artifact org.apache.maven.plugins:maven-surefire-plugin:jar:2.22.1 has not been downloaded from it before. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

maven-surefire-plugin:2.22.1 or one of its dependencies could not be resolved_第1张图片

pom.xml添加如下:

    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
                
                    true
                    true
                
            
            
                org.apache.maven.plugins
                maven-surefire-plugin
                2.22.1
                
                    true
                
            
        
    

删除多余的版本:

 

maven-surefire-plugin:2.22.1 or one of its dependencies could not be resolved_第2张图片

构建成功!

 

maven-surefire-plugin:2.22.1 or one of its dependencies could not be resolved_第3张图片

你可能感兴趣的:(运维部署)