首次创建Maven工程时遇到Could not transfer artifact org.codehaus.groovy:groovy:jar:2.4.16 from/to central。。问题

嵇浩然
2023-12-01

使用quick start骨架创建Maven工程时,总是遇到jar包从中央仓库下载失败的问题,提示的log如下:

[IJ]-1-ARTIFACT_DOWNLOADED-[IJ]-path=-[IJ]-artifactCoord=org.codehaus.groovy:groovy:jar:2.4.16-[IJ]-error=Could not transfer artifact org.codehaus.groovy:groovy:jar:2.4.16 from/to central (https://repo.maven.apache.org/maven2): GET request of: org/codehaus/groovy/groovy/2.4.16/groovy-2.4.16.jar from central failed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

解决办法:

Maven目录->config->settings,添加以下mirror tag(即使用阿里云的仓库):

     <mirror>  
       <id>alimaven</id>  
      <name>aliyun maven</name>  
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
      <mirrorOf>central</mirrorOf>          
    </mirror>

重新创建项目,问题顺利解决!

 

 

参考链接:

https://www.cnblogs.com/zhangcaiwang/p/6790665.html

 

 

 类似资料: