记录本地部署 Nacos 踩过的坑

最近在做个人网站,需要用到 Nacos,打包时碰到了几个坑,一起来看看吧

打包

问题:在 PowerShell 中输入mvn -Prelease-nacos -Dmaven.test.skip=true clean install -U

1
[ERROR] Unknown lifecycle phase ".test.skip=true". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]

解决:

  1. 首先看控制台,提示我们无法识别 “.test.skip=true”

  2. 那么添加引号不就行了,如下

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

编译报错

解决了上面的问题,重新打包后又出现新的问题

1
[ERROR] /E:/Code/nacos/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/DistroConsistencyServiceImpl.java:[92,26] 已在类 com.alibaba.nacos.naming.consistency.ephemeral.distro.DistroConsistencyServiceImpl中定义了变 量 loadDataTask

解决:找到 /E:.../DistroConsistencyServiceImpl.java,果然多了一个LoadDataTask,删除一个即可

1
private LoadDataTask loadDataTask = new LoadDataTask();

评论