a303153878 2022-04-07 18:10 采纳率: 0%
浏览 89

宿主机不想装maven,想使用docker的maven镜像编译项目,打成jar包 ,但是maven容器一直启动不了

问题遇到的现象和发生背景

本地maven可以打包linux的maven容器打不了包

不要说注释 和更改里面的值

docker run -it --rm -v maven-repo:/root/.m2 -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven registry.cn-hangzhou.aliyuncs.com/acs/maven:3-jdk-8 mvn clean package -DskipTests
问题相关代码,请勿粘贴截图

任何springboot代码都不行

运行结果及报错内容
[root@weewemice]# docker run -it --rm -v maven-repo:/root/.m2 -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven registry.cn-hangzhou.aliyuncs.com/acs/maven:3-jdk-8 mvn clean package -DskipTests
[INFO] Scanning for projects...
Downloading from aliyun-nexus: http://maven.aliyun.com/nexus/content/groups/public/org/springframework/boot/spring-boot-dependencies/2.1.3.RELEASE/spring-boot-dependencies-2.1.3.RELEASE.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: commons-fileupload:commons-fileupload:jar -> duplicate declaration of version 1.3.2 @ line 92, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: commons-codec:commons-codec:jar -> duplicate declaration of version 1.9 @ line 97, column 21
[FATAL] Non-resolvable parent POM for org.hoyozero.mice:mice:1.0-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-dependencies:pom:2.1.3.RELEASE from/to aliyun-nexus (http://maven.aliyun.com/nexus/content/groups/public/): maven.aliyun.com: Temporary failure in name resolution and 'parent.relativePath' points at no local POM @ line 11, column 13
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project org.hoyozero.mice:mice:1.0-SNAPSHOT (/usr/src/mymaven/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for org.hoyozero.mice:mice:1.0-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-dependencies:pom:2.1.3.RELEASE from/to aliyun-nexus (http://maven.aliyun.com/nexus/content/groups/public/): maven.aliyun.com: Temporary failure in name resolution and 'parent.relativePath' points at no local POM @ line 11, column 13: Unknown host maven.aliyun.com: Temporary failure in name resolution -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
[root@iZ2zea17dskhimi1m716kfZ mice]# docker run -it --rm -v maven-repo:/root/.m2 -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven registry.cn-hangzhou.aliyuncs.com/acs/maven:3-jdk-8 mvn clean package -DskipTests


我的解答思路和尝试过的方法

这些方法我都试过了不行
https://www.jb51.net/article/141431.htm
https://baijiahao.baidu.com/s?id=1727466767605824176&wfr=spider&for=pc
https://hub.docker.com/_/maven

我想要达到的结果

可以用maven容器把源码编译成jar包

  • 写回答

1条回答 默认 最新

  • IT民工金鱼哥 运维领域新星创作者 2022-04-08 09:08
    关注

    这个,其实,直接装maven,不是更香吗。。。

    评论

报告相同问题?

问题事件

  • 创建了问题 4月7日

悬赏问题

  • ¥15 欧拉系统opt目录空间使用100%
  • ¥15 ul做导航栏格式不对怎么改?
  • ¥20 用户端如何上传图片到服务器和数据库里
  • ¥15 现在研究生在烦开题,看了一些文献,但不知道自己要做什么,求指导。
  • ¥30 vivado封装时总是显示缺少一个dcp文件
  • ¥100 pxe uefi启动 tinycore
  • ¥15 我pycharm运行jupyter时出现Jupyter server process exited with code 1,然后打开cmd显示如下
  • ¥15 可否使用carsim-simulink进行四轮独立转向汽车的联合仿真,实现四轮独立转向汽车原地旋转、斜向形式、横移等动作,如果可以的话在carsim中如何进行相应设置
  • ¥15 Caché 2016 在Java环境通过jdbc 执行sql报Parameter list mismatch错误,但是同样的sql使用连接工具可以查询出数据
  • ¥15 疾病的获得与年龄是否有关