侧边栏壁纸
  • 累计撰写 26 篇文章
  • 累计创建 9 个标签
  • 累计收到 1 条评论

目 录CONTENT

文章目录

在spug中如何解决maven下载依赖问题

仓鼠
2024-04-17 / 0 评论 / 0 点赞 / 7 阅读 / 3163 字 / 正在检测是否收录...

在spug中如何解决maven下载依赖问题

今天在spug发版时,因为升级了qiniuyun 的SDK,导致出现了编译异常,内容如下


Downloading from aliyunmaven: https://maven.aliyun.com/repository/public/com/qiniu/qiniu-java-sdk/7.15.0/qiniu-java-sdk-7.15.0.pom
....
[ERROR] Failed to execute goal on project ruoyi-modules-device: Could not resolve dependencies for project com.ruoyi:ruoyi-modules-device:jar:3.2.0: Failed to collect dependencies at com.qiniu:qiniu-java-sdk:jar:7.15.0: Failed to read artifact descriptor for com.qiniu:qiniu-java-sdk:jar:7.15.0: Could not transfer artifact com.qiniu:qiniu-java-sdk:pom:7.15.0 from/to aliyunmaven (https://maven.aliyun.com/repository/public): transfer failed for https://maven.aliyun.com/repository/public/com/qiniu/qiniu-java-sdk/7.15.0/qiniu-java-sdk-7.15.0.pom: Unknown host archiva-maven-storage-prod.oss-cn-beijing.aliyuncs.com: Name or service not known -> [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/DependencyResolutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :ruoyi-modules-device
cp: cannot stat ‘ruoyi-modules/ruoyi-device/target/ruoyi-modules-device.jar’: No such file or directory

exit code: 1

从报错内容中,我们很容易发现,其实是maven下载的问题

严重的是反复的编译都提示下载问题。

首先我们要解决maven中setting的配置

  1. 进入docker

docker exec -it spug /bin/bash
  1. 修改setting

vi /opt/apache-maven-3.x.x/conf/settings.xml

<mirror>
    <id>aliyunmaven</id>
    <mirrorOf>*</mirrorOf>
    <name>阿里云公共仓库</name>
    <url>https://maven.aliyun.com/repository/public</url>
</mirror>
  1. 清理repository

#进入仓库
cd /root/.m2/repository
# 找到我们存在问题的jar
cd com/qiniu/qiniu-java-sdk
# 删除存在问题的版本和jar
[root@3535f671fd07 7.15.0]# ls
qiniu-java-sdk-7.15.0.pom.lastUpdated
[root@3535f671fd07 7.15.0]# rm -rf qiniu-java-sdk-7.15.0.pom.lastUpdated
  1. 我们再次下载,看是否还报错

mvn dependency:resolve -DgroupId=com.qiniu -DartifactId=qiniu-java-sdk -Dversion=7.15.0

如果还是下载错误,我们重复 3 4 的操作

如果反复还是报错,那我们就要前往
https://mvnrepository.com/

查看是否存在这个jar包了,还有测试服务器是否外网通常

0

评论区