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

【智慧物联网平台】编译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.lryc.cn/news/602392.html

相关文章:

  • 解构远程智能系统的视频能力链:从RTSP|RTMP协议接入到Unity3D头显呈现全流程指南
  • Ansible安装与入门
  • WPF,按钮透明背景实现MouseEnter
  • 【Linux】Ubuntu上安装.NET 9运行时与ASP.NET Core项目部署入门
  • C#/.NET/.NET Core技术前沿周刊 | 第 48 期(2025年7.21-7.27)
  • 1.gradle安装(mac)
  • 基于AFLFast的fuzz自动化漏洞挖掘(1)
  • 全新AI工具小程序源码 全开源
  • 时序数据库选型指南:工业大数据场景下基于Apache IoTDB技术价值与实践路径
  • Verilog简易的按键消抖模块
  • css 实现虚线效果的多种方式
  • Kubernetes 存储入门
  • 【自动化运维神器Ansible】Ansible常用模块之unarchive模块详解
  • 快速入门Linux操作系统(二)
  • 腾讯AI IDE
  • 《红色脉络:一部PLMN在中国的演进史诗 (1G-6G)》 第3篇 | 2G:GSM一统江湖?——移动、联通的“分家”与双轨并行
  • windows平台计划任务批处理实现定时任务
  • 零基础学习性能测试第九章:全链路追踪-系统中间件节点监控
  • DDD领域驱动中瘦模型与富态模型的核心区别
  • FastGPT本地构建工作流高级编排(最新4.11.0)
  • 火狐浏览器中国特供版关闭,如何下载 Firefox 国际版?如何备份数据?
  • App Inventor 2 使用 MaterialIcons 图标字体,快捷展示专业图标
  • NAS远程访问新解法:OMV与cpolar的技术协同价值
  • CentOS7 安装和配置教程
  • nvim tagbar安装
  • VUE2 学习笔记11 脚手架
  • 架构实战——互联网架构模板(“存储层”技术)
  • 黑马商城微服务-下
  • 云服务器以域名形式访问机房Kubernetes集群服务之解决方案
  • 国产化PDF处理控件Spire.PDF教程:Java 提取 PDF 图片,高质量提取与图片过滤技巧