Nacos源码修改后打包发布遇到的问题,Nacos源码打包

记录Nacos下载源码后,进行一定的修改,拓展后,打包遇到的问题

Nacos官网:https://nacos.io/zh-cn/docs/quick-start.html

1.Nacos源码打包

       mvn test
       mvn -Prelease-nacos -Dmaven.test.skip=true clean install -U
       Building说明文件中有一步是run一下测试(建议跳过),打包时,最好是管理员权限运行windows指令执行器,进入到Nacos目录夹下,直接Maven指令打包,不要在IDEA Terminal下执行(个人在Terminal下执行时螺旋报错),Windows命令执行器中使用Maven指令打包,也可能遇到下面的问题,这里的经验仅供参考

2.打包时严格的编码格式校验问题

       1、找到config模块下,target目录夹下,pmd.xml里面记录了不符合规范的编码,一一更改。
       2、跳过格式校验:Nacos(all) pom.xml Build plugins配置中启用了格式校验插件,在pom.xml中找到maven-pmd-plugin,maven-checkstyle-plugin相关控件配置,注释掉。


Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.2:check (validate) on project nacos-config: Failed during checkstyle execution: There are 390 errors reported by Checkstyle 8.29 with style/NacosCheckStyle.xml ruleset. -> [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]

Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.1.2:check (validate) on project nacos-config: Failed during checkstyle execution: There are 390 errors reported by Checkstyle 8.29 with style/NacosCheckStyle.xml ruleset. -> [Help 1]

3.新增文件没有经过Lisence权限认证

        1、\config\target\rat.txt中记录了未认证的类,对新增的文件加载Lisence认证(没研究在哪里加)
        2、跳过认证:Nacos(all) pom.xml 配置中,找到apache-rat-plugin控件组,注释掉相关插件配置。

[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.12:check (default) on project nacos-config: Too many files with unapproved license: 10 See RAT report in: D:\IdeaProject\nacos-2.0.3\config\target\rat.txt -> [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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :nacos-config

4. 启动关闭指令


3.启动服务器
Linux/Unix/Mac
启动命令(standalone代表着单机模式运行,非集群模式):
sh startup.sh -m standalone

Windows
启动命令(standalone代表着单机模式运行,非集群模式):
startup.cmd -m standalone

5.关闭服务器
Linux/Unix/Mac
sh shutdown.sh

Windows
shutdown.cmd

或者双击shutdown.cmd运行文件。

Idea单机启动
Environment中加启动条件
VM options: -Dnacos.standalone=true

5.Linux部署报错

sh xxxx ,报脚本格式不规范,又逗号,空格什么的格式不对执行:
./startup.sh : bin/bash’M :bad interpreter:no such file or directory : 脚本格式不规范,或者是不是Linux规范脚本。执行一下命令,再不行更换脚本

sed -i 's/\r//g' xxx.sh   //清除脚本文件中的空格,换行等不规范格式

脚本没有权限:

sudo chomd -R 777 xxxx.sh / chomd -R 777 xxxx.sh  //给sh脚本赋予权限

数据库sql建表语句执行报错

Mysql执行 distribution模块conf/nacos-mysql.sql中的内容
注意:Mysql数据库必须是5.7+版本
	 建schema table的时候 字符集必须是utf8,不需要选utf8mb4,sql语句
	 中都指定了
  • 6
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值