2023 nacos 2.2.1-RC版本源码学习

环境

jdk8,高版本jdk18会有一些问题,如ResponseUtilTest编译失败

一、clone并本地启动测试

①启动console项目,建议启动单机模式,方便研究。从启动脚本start.sh可知应在vm options设置-Dnacos.standalone=true即可。 访问http://localhost:8848/nacos ,默认用户及密码nacos/nacos ②启动example模块下ConfigExample测试配置监听

启动后,在web新增Data ID:test 及测试配置项a: 123 保存后即可被监听到

③启动example模块下NamingExample测试服务注册与订阅

启动后web可以看到注册上去的服务及其订阅者,注意须多打几个断点以观效果

二、项目结构 windows tree 不够用,使用node npm安装一个类Linux tree

npm install -g cnpm --registry=https://registry.npm.taobao.org
npm config set registry https://registry.npm.taobao.org
cnpm install -g tree-node-cli
treee -h
D: acos221>treee -L 1 -a nacos221 ├── .flattened-pom.xml # maven版本管理插件flatten-maven-plugin,打包时自动替换版本号占位符revision产生的pom ├── .git ├── .gitattributes ├── .github # github web页面设置ci相关脚本如代码检查、编译打包、覆盖率测试等 ├── .gitignore #cvs忽略的文件文件夹 ├── .idea ├── .travis.yml #github web在线build配置 ├── BUILDING ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── NOTICE ├── README.md ├── REPORTING-BUGS.md ├── address ├── api ├── auth ├── client ├── cmdb ├── codecov.yml ├── common ├── config ├── consistency ├── console ├── console-ui ├── core ├── derby.log ├── distribution ├── doc ├── example ├── istio ├── logs ├── naming ├── plugin ├── plugin-default-impl ├── pom.xml ├── prometheus ├── resources ├── style ├── sys ├── target ├── test └── work
经验分享 程序员 微信小程序 职场和发展