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

Nacos源码 (1) 源码编译及idea环境

本文介绍从gitee下载nacos源码,在本地编译,并导入idea进行本地调试。

从gitee下载源码

由于github访问速度慢,所以我选择使用gitee的镜像仓库:

git clone https://gitee.com/mirrors/Nacos.git

本文使用2.0.2版本,所以需要切换到2.0.2分支:

cd Nacos
git checkout 2.0.2

创建一个自己的分支,用于保存笔记和代码注释:

git checkout -b my-2.0.2

本地编译

mvn -Dmaven.test.skip=true -Drat.skip=true clean install

构建发布包

mvn -Prelease-nacos -Dmaven.test.skip=true -Drat.skip=true clean install -U

这种构建方式会在distribution/target目录下生成nacos-server-2.0.2.zip包,从官网下载的就是这样的包。

但是会抛错:

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.1.0:repackage (default) on project nacos-console: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:3.1.0:repackage failed: Unable to load the mojo 'repackage' in the plugin 'org.springframework.boot:spring-boot-maven-plugin:3.1.0' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/springframework/boot/maven/RepackageMojo has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

将工程使用的spring-boot-maven-plugin版本改成2.3.8.RELEASE版本即可:

<plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><version>2.3.8.RELEASE</version>
</plugin>

idea开发环境

导入到idea

File -> Open导入即可。

启动console

找到console/src/main/java/com/alibaba/nacos/console/config/ConsoleConfig.java文件,修改PropertySource注解值:

// @PropertySource("/application.properties")
@PropertySource("classpath:application.properties")
public class ConsoleConfig {

/application.properties改为classpath:application.properties。

需要添加一些环境变量和参数:

  • -Dnacos.standalone=true
  • –logging.config=classpath:nacos-logback.xml

如果需要自定义日志就使用–logging.config指定配置文件路径。

访问console

http://localhost:8848/nacos

用户名:nacos

密码:nacos

http://www.lryc.cn/news/102829.html

相关文章:

  • docker配置文件挂载(容器数据管理)
  • uniAPP 视频图片预览组件
  • 【论文阅读】The Deep Learning Compiler: A Comprehensive Survey
  • 怎么维护自己的电脑?
  • day52|● 300.最长递增子序列 ● 674. 最长连续递增序列 ● 718. 最长重复子数组
  • uniapp,vue3路由传递接收参数
  • SkyEye与Jenkins的DevOps持续集成解决方案
  • HCIE Security——防火墙互联技术
  • Rust- 闭包
  • 【数据挖掘torch】 基于LSTM电力系统负荷预测分析(Python代码实现)
  • 「JVM」性能调优工具
  • IDEA Debug小技巧 添加减少所查看变量、查看不同线程
  • 基于SpringBoot+Vue的车辆充电桩管理系统设计与实现(源码+LW+部署文档等)
  • Bean的加载方式
  • 《吐血整理》进阶系列教程-拿捏Fiddler抓包教程(13)-Fiddler请求和响应断点调试
  • Android 13(T) - Media框架(1)- 总览
  • 简述vue3(ts)+antdesignvue项目框架搭建基本步骤
  • webpack : 无法加载文件 C:\Program Files\nodejs\webpack.ps1
  • GDAL OGR C++ API 学习之路 (5)OGRLayer篇 代码示例
  • NIDEC COMPONENTS尼得科科宝滑动型DIP开关各系列介绍
  • 一起学算法(滑动窗口篇)
  • HTML <q> 标签
  • 机器学习02-再识K邻近算法(自定义数据集训练及测试)
  • github使用笔记及git协作常用命令
  • iOS - Apple开发者账户添加新测试设备
  • vue 前端 邮箱、密码、手机号码等输入验证规则
  • 如何看待前端已死这个问题(大学生篇)
  • 揭开高级产品经理思维的秘密
  • Java 学习路线图
  • 在springboot项目中使用策略工厂模式