因为thingsboard都是国外的资料,国内基本没有参考资料。所以,记录下来源码安装当中,遇到的问题。
thingsboard官网源码安装连接:
mvn clean install -DskipTests
这一步的时候,报一下错误:
<nodeVersion>v6.9.1</nodeVersion>
<npmVersion>3.10.8</npmVersion>
需要改成对应本地的版本号。
如果还是报错,将已经安装的D:\Program Files\nodejs\node.exe(node的安装路径)复制到maven对应的目录下D:\m2\com\github\eirslett\node\10.1.0(maven下的node目录,版本号自行对应)
问题二
mvn clean install -DskipTests
这一步的时候,报一下错误:
[ERROR] npm ERR! code ENOGIT
[ERROR] npm ERR! No git binary found in $PATH
[ERROR] npm ERR!
[ERROR] npm ERR! Failed using git.
[ERROR] npm ERR! Please check if you have git installed and in your PATH.
[ERROR]
[ERROR] npm ERR! A complete log of this run can be found in:
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.0:npm
(npm install) on project ui: Failed to run task: 'npm install' failed. (error c
ode 1) -> [Help 1]
原因:
没有安装git或者是没有配置git的环境变量
问题三
[ERROR] Failed to execute goal com.mycila:license-maven-plugin:3.0:check (default) on project xxx: Some files do not have the expected license header -> [Help 1]
原因:
因为maven会对license进行检车check,而配置文件缺少头部license声明,所以报错,无法执行下去。
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
修改根目录下的pom.xml的内容:
<configuration>
<sources>
<!-- <source>${basedir}/target/generated-sources</source> -->
<source>${basedir}/target/generated-sources/grpc-java</source>
<source>${basedir}/target/generated-sources/java</source>
</sources>
</configuration>
I got successful maven build.
However, this is lots of code errors in the code base. The errors are categories to four types.
Eclipse complains log object does not define.
e.g. log.info("[{}:{}] MQTT broker connection established!", configuration.getHost(), configuration.getPort());Eclipse complains final variables not initialized. "The blank final field nodeId may not have been initialized"
Object function setter & getter function undefines. I saw properties but there is not explicitly setter and getter for those properties.
4 Object not constructor. I saw some objects only has properties (some of them define as final), However, this is not constructors for those objects.
原因:
安装lombok插件
方案:https://github.com/thingsboard/thingsboard-gateway/issues/36
Lombok plugin for Eclipse
安装lombok方法:https://blog.****.net/dorothy1224/article/details/79280591/
问题六
src.main都作为了路径,无法形成maven项目
方法:
屏蔽pom.xml文件中的protobuf插件。涉及到的项目有application,extensions-core。屏蔽后,需要在maven选项中update project
问题七
extension-sns,extension-sqs报错:
The type org.apache.velocity.Template cannot be resolved
方法:
在这两个项目中添加依赖
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
</dependency>
问题八
application报错:
ClusterAPIProtos cannot be resolved ClusterGrpcService.java
方法:
将application\target\generated-sources\protobuf\grpc-java\org\thingsboard\server\gen,
application\target\generated-sources\protobuf\java\org\thingsboard\server\gen,
extensions-core\target\generated-sources\protobuf\java\org\thingsboard\server\plugin\telmetry\gen生成的
代码(包括目录)复制到src中
问题九
忘记是什么问题了,但是需要在maven的setting.xml文件中加配置信息:
<activeProfiles>
<activeProfile>env-thing</activeProfile>
</activeProfiles>