今天在重新安装MAVEN时想试试本地仓库有没有生效,执行:mvn help:system 出错
错误截图
网上搜索了一大堆解决方案,都是说镜像错误,尝试修改镜像。
镜像一:
<mirrors> <!-- mirror | Specifies a repository mirror site to use instead of a given repository. The repository that | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used | for inheritance and direct lookup purposes, and must be unique across the set of mirrors. | <mirror> <id>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://my.repository.com/repo/path</url> </mirror> --> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>uk</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://uk.maven.org/maven2/</url> </mirror> <mirror> <id>CN</id> <name>OSChina Central</name> <url>http://maven.oschina.net/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>nexus</id> <name>internal nexus repository</name> <!-- <url>http://192.168.1.100:8081/nexus/content/groups/public/</url>--> <url>http://repo.maven.apache.org/maven2</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors>
依然报错
镜像二:根据阿里云maven官网来配置镜像 官网:https://maven.aliyun.com/mvn/guide
<mirror> <id>aliyunmaven</id> <mirrorOf>*</mirrorOf> <name>阿里云公共仓库</name> <url>https://maven.aliyun.com/repository/public</url> </mirror>
依然不好用
镜像三:据说原因是在联通网络下,无法访问maven.org网站,而我刚好是联通网,尝试如下镜像
<mirror> <id>ibiblio.org</id> <name>ibiblio Mirror of http://repo1.maven.org/maven2/</name> <url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url> <mirrorOf>central</mirrorOf> <!-- United States, North Carolina --> </mirror> <mirror> <id>jboss-public-repository-group</id> <mirrorOf>central</mirrorOf> <name>JBoss Public Repository Group</name> <url>http://repository.jboss.org/nexus/content/groups/public</url> </mirror>
依然不好用,切回电信网络后尝试了下面的镜像,
<mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror>
成功了!!!
但是 却发现 相应的jar包不在我配置的本地仓库“D:\apache-maven-repository”里 而是在它自动生成的“D:\server\maven\repository” 路径下有没有大佬知道是怎么回事,我的maven版本是3.8.1
本地仓库配置