源码环境搭建

编译打包

1、官网:https://nacos.io/en-us/,进入源码仓库https://github.com/alibaba/nacosfork一份到自己github下,然后git clone下载到本地;

2、我们这里编译nacos 1.2.1版本,git tag查看所有tag,使用git checkout 1.2.1进行切换;

3、下载源码后,进入nacos目录下,执行打包:mvn -Prelease-nacos clean install -U -Dmaven.test.skip=true

源码环境搭建_第1张图片

4、打包成功后, 在nacos/distribution/target文件夹里面,会生成nacos-server-1.2.1.zipnacos-server-1.2.1.tar.gz,任一个拷贝到服务器上解压,执行bin/startup脚本启动

5、访问:http://localhost:8848/nacos,默认账号:nacos/nacos

源码环境搭建_第2张图片


调试运行

将上面编译打包生成的nacos-server-1.2.1.zip解压出nacos-server.jar,并打开jarMANIFEST.MF可以看到:

Manifest-Version: 1.0
Implementation-Title: nacos-console 1.2.1
Implementation-Version: 1.2.1
Archiver-Version: Plexus Archiver
Built-By: Administrator
Specification-Vendor: Alibaba Group
Specification-Title: nacos-console 1.2.1
Implementation-Vendor-Id: com.alibaba.nacos
Spring-Boot-Version: 2.1.1.RELEASE
Implementation-Vendor: Alibaba Group
Main-Class: org.springframework.boot.loader.PropertiesLauncher
Start-Class: com.alibaba.nacos.Nacos
Spring-Boot-Classes: BOOT-INF/classes/
Spring-Boot-Lib: BOOT-INF/lib/
Created-By: Apache Maven 3.1.1
Build-Jdk: 1.8.0_212
Specification-Version: 1.2.1

其中Start-Class: com.alibaba.nacos.Nacos指定了启动类为com.alibaba.nacos.Nacos。把工程导入到IDEA中,启动com.alibaba.nacos.Nacos,并设置VM option:-Dnacos.standalone=true,即采用非集群模式启动。

源码环境搭建_第3张图片

然后,访问http://127.0.0.1:8848/nacos即可。

              长按识别关注,持续输出原创

你可能感兴趣的:(源码环境搭建)