Maven项目报错:Cannot access nexus-aliyun (http://maven.aliyun.com/nexus/content/...) in offline mode

时间:2024-03-22 16:03:07

一、问题描述

Maven项目使用idea打开后,无论如何都无法导入pom里面的依赖,点击reimport就瞬间结束。

Maven项目报错:Cannot access nexus-aliyun (http://maven.aliyun.com/nexus/content/...) in offline mode 
然后,install项目会报以下错误,很是奇葩。
 Maven项目报错:Cannot access nexus-aliyun (http://maven.aliyun.com/nexus/content/...) in offline mode
即:

[ERROR] Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved: Cannot access nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public) in offline mode and the artifact org.apache.maven.plugins:maven-install-plugin:jar:2.4 has not been downloaded from it before. -> [Help 1]

二、问题原因

报错清晰说明了,是因为依赖都无法下载。而导致依赖无法下载的原因,是因为项目被设置为offline mode。因为项目是拷贝过来的,所以,不知道之前是怎么回事,真是很坑。

三、解决办法

知道问题原因,解决办法,就是设置maven配置取消offline mode.
File-》Settings-》Build,Execution,Deployment-》Build Tools-》Maven-》取消Work offline
Maven项目报错:Cannot access nexus-aliyun (http://maven.aliyun.com/nexus/content/...) in offline mode


四、参考:

1.https://blog.csdn.net/doudou0809/article/details/80345789