当前位置: 首页 > ops >正文

【智慧物联网平台】编译jar环境 Linux 系统编译IOT物联网——仙盟创梦IDE

1.进入解压目录

2. 编译 

mvn clean package -Dmaven.test.skip=true

 

 加载运行环境

 

 

BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  06:04 min
[INFO] Finished at: 2025-07-28T16:00:10+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean (default-clean) on project java110-boot: Execution default-clean of goal org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean failed: Plugin org.apache.maven.plugins:maven-clean-plugin:3.1.0 or one of its dependencies could not be resolved:
[ERROR]         Could not transfer artifact org.codehaus.plexus:plexus-component-annotations:jar:1.7.1 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/146.75.44.215, repo.maven.apache.org/2a04:4e42:7b:0:0:0:0:215] failed: Network is unreachable (connect failed)
[ERROR] 
[ERROR] -> [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/PluginResolutionException
[root@iZ2vcbr09kxsytmlhp8egbZ java110-boot]# 

从错误信息来看,Maven 构建失败的核心原因是 无法连接到 Maven 中央仓库(repo.maven.apache.org:443),导致 maven-clean-plugin 及其依赖(如 plexus-component-annotations)无法下载。具体解决方法如下:

一、排查网络连接问题

  1. 检查服务器网络是否通畅
    执行以下命令测试能否访问 Maven 中央仓库:

    bash

    # 测试 DNS 解析
    nslookup repo.maven.apache.org# 测试网络连接(能否访问 443 端口)
    telnet repo.maven.apache.org 443
    # 或使用 curl 测试
    curl -v https://repo.maven.apache.org/maven2
    
     
    • 若提示 Network is unreachable 或连接超时,说明服务器网络无法访问外部仓库,需检查:
      • 服务器是否有网络权限(如阿里云服务器的安全组是否开放出站 443 端口)。
      • 是否使用了代理服务器,需配置代理(见下文)。
      • 服务器所在网络是否屏蔽了 Maven 中央仓库(如企业内网限制)。

二、配置阿里云 Maven 镜像(推荐)

由于国内访问 Maven 中央仓库可能较慢或不稳定,建议切换为 阿里云镜像(速度更快,无需科学上网):

  1. 修改 Maven 全局配置文件
    找到 Maven 的 settings.xml 文件(路径参考):

    • 若通过包管理器安装:/etc/maven/settings.xml
    • 若手动安装:/usr/local/maven/conf/settings.xml
    • 若为用户级配置:~/.m2/settings.xml(若无则创建)
  2. 添加阿里云镜像
    在 <mirrors> 标签内添加以下配置:

    xml

    <mirrors><mirror><id>aliyunmaven</id><mirrorOf>*</mirrorOf><name>阿里云公共仓库</name><url>https://maven.aliyun.com/repository/public</url></mirror><!-- 若需要其他仓库(如 Spring 仓库),可补充 --><mirror><id>aliyun-spring</id><mirrorOf>spring</mirrorOf><url>https://maven.aliyun.com/repository/spring</url></mirror>
    </mirrors>
    

三、若使用代理服务器,配置 Maven 代理

如果服务器需要通过代理访问外部网络,需在 settings.xml 中配置代理:

xml

<proxies><proxy><id>proxy</id><active>true</active><protocol>https</protocol> <!-- 代理协议,http 或 https --><host>代理服务器IP或域名</host><port>代理端口</port><!-- 若代理需要认证 --><!-- <username>代理用户名</username> --><!-- <password>代理密码</password> --><!-- 不需要代理的地址(可选) --><!-- <nonProxyHosts>localhost|127.0.0.1</nonProxyHosts> --></proxy>
</proxies>

四、清理本地 Maven 仓库缓存

若之前下载过部分依赖但不完整,可能导致缓存冲突,执行以下命令清理:

bash

# 进入本地仓库目录(默认 ~/.m2/repository)
cd ~/.m2/repository# 删除插件相关的缓存目录(根据错误中的插件路径)
rm -rf org/apache/maven/plugins/maven-clean-plugin/
rm -rf org/codehaus/plexus/plexus-component-annotations/

五、重新构建项目

完成上述配置后,再次执行构建命令:

bash

# 清理并重新构建(加 -U 强制更新依赖)
mvn clean package -U

  • -U 参数强制 Maven 检查远程仓库的更新,避免使用本地缓存的错误依赖。

六、其他可能的原因

  1. Maven 版本兼容问题
    若 maven-clean-plugin:3.1.0 持续报错,可尝试在 pom.xml 中指定更低版本的插件(如 3.0.0):

    xml

    <build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-clean-plugin</artifactId><version>3.0.0</version></plugin></plugins>
    </build>
    
  2. 服务器时间同步问题
    若服务器时间与实际时间偏差较大,可能导致 SSL 证书验证失败,执行以下命令同步时间:

    bash

    # 安装时间同步工具
    sudo dnf install -y ntpdate
    # 同步网络时间
    sudo ntpdate ntp.aliyun.com
    

    阿雪技术观

在科技发展浪潮中,我们不妨积极投身技术共享。不满足于做受益者,更要主动担当贡献者。无论是分享代码、撰写技术博客,还是参与开源项目维护改进,每一个微小举动都可能蕴含推动技术进步的巨大能量。东方仙盟是汇聚力量的天地,我们携手在此探索硅基生命,为科技进步添砖加瓦。

Hey folks, in this wild tech - driven world, why not dive headfirst into the whole tech - sharing scene? Don't just be the one reaping all the benefits; step up and be a contributor too. Whether you're tossing out your code snippets, hammering out some tech blogs, or getting your hands dirty with maintaining and sprucing up open - source projects, every little thing you do might just end up being a massive force that pushes tech forward. And guess what? The Eastern FairyAlliance is this awesome place where we all come together. We're gonna team up and explore the whole silicon - based life thing, and in the process, we'll be fueling the growth of technology.

http://www.xdnf.cn/news/16462.html

相关文章:

  • MySQL SQL性能优化与慢查询分析实战指南:新手DBA成长之路
  • 接口测试核心概念与实践指南
  • Error reading config file (/home/ansible.cfg): ‘ACTION_WARNINGS(default) = True
  • ABP Framework + EF Core 迁移命令失败问题完整解决记录
  • 开发笔记 | 实现人物立绘的差分效果
  • 全面解析MySQL(4)——三大范式与联合查询实例教程
  • LeetCode|Day28|67. 二进制求和|Python刷题笔记
  • 【MySQL学习|黑马笔记|Day1】数据库概述,SQL|通用语法、SQL分类、DDL
  • 归档日志-binlog
  • 元宇宙工厂前端新形态:Three.js与WebGL实现3D产线交互的轻量化之路
  • XCF32PVOG48C Xilinx Platform Flash PROM
  • Maven中的bom和父依赖
  • [Linux]线程池
  • 【免费可用】【提供源代码】对YOLOV11模型进行剪枝和蒸馏
  • 跨境协作系统文化适配:多语言环境下的业务符号隐喻与交互习惯
  • Java项目:基于SSM框架实现的社区团购管理系统【ssm+B/S架构+源码+数据库+毕业论文+答辩PPT+远程部署】
  • Nuxt3 全栈作品【通用信息管理系统】修改密码
  • 亚远景-“过度保守”还是“激进创新”?ISO/PAS 8800的99.9%安全阈值之争
  • 【NLP舆情分析】基于python微博舆情分析可视化系统(flask+pandas+echarts) 视频教程 - 微博文章数据可视化分析-点赞区间实现
  • 【HTTP】防XSS+SQL注入:自定义HttpMessageConverter过滤链深度解决方案
  • 【数据标注】详解使用 Labelimg 进行数据标注的 Conda 环境搭建与操作流程
  • 572. 另一棵树的子树
  • 电子签章(PDF)
  • 【0基础PS】PS工具详解--选择工具--对象选择工具
  • 【Linux | 网络】传输层(UDP和TCP) - 两万字详细讲解!!
  • 利用软件定义无线USRP X410、X440 电推进无线原型设计
  • ksql连接数据库免输入密码交互
  • 设计模式(十四)行为型:职责链模式详解
  • 飞牛NAS本地化部署n8n打造个人AI工作流中心
  • 【Java系统接口幂等性解决实操】