thingsboard填坑之路

由于thingsboard都是国外的资料,国内基本没有参考资料。因此,记录下来源码安装当中,遇到的问题。java

thingsboard官网源码安装链接:node

 
个人安装环境:win7,已有软件:node,eclipse,maven
 
问题一
根据官方的安装步骤,执行到
mvn clean install -DskipTests 
这一步的时候,报一下错误:
 
Failed to run task: 'npm install' failed. java.io.IOException: Cannot run program "E:\git\thingsboard\ui\target\node\node.exe" (indirectory "E:\git\thingsboard\ui"): CreateProcess error=193, %1 不是有效的 Win32 应用程序。 -> [Help 1]
 
缘由:
在UI在的pom.xml文件中,默认指定了安装node的版本号。若是以前没有安装过node的话,应该不会报这个错误的。由于我以前安装过的,因此须要修改pom.xml
里面的node版本号:

<nodeVersion>v6.9.1</nodeVersion>
<npmVersion>3.10.8</npmVersion>git

须要改为对应本地的版本号。github

若是仍是报错,将已经安装的D:\Program Files\nodejs\node.exe(node的安装路径)复制到maven对应的目录下D:\m2\com\github\eirslett\node\10.1.0(maven下的node目录,版本号自行对应)apache

 

问题二npm

根据官方的安装步骤,执行到
mvn clean install -DskipTests 
这一步的时候,报一下错误:

[ERROR] npm ERR! code ENOGITapp

[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:frontend

 

[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]eclipse

 

缘由:iphone

没有安装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声明,因此报错,没法执行下去。

mvn clean install -DskipTests license:format
增长  license:format 参数
 
若是仍是报错,则须要屏蔽根目录下的pom.xml文件代码段:

<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>

 
 
打包成功效果图:
 
问题四
build完成后,导入到eclipse。报错找不到相关的类或者方法,譬如:
The import org.thingsboard.server.extensions.core.plugin.telemetry.gen cannot be resolved
AttributeUpdateProto cannot be resolved to a type
 
缘由:

修改根目录下的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>

 
protobuf相关的代码文件没有生成。
使用protobuf生成对应的文档。只须要用protobuf.exe在eclipse以外生成对应的java文件“org.thingsboard.server.extensions.core.plugin.telemetry.gen”便可
在extensions-core的target/generated-sources中,也能找到生成的文件,直接拷贝到src对应的目录亦可。 同时,须要把application项目和extensions-core项目中的路径target/generated-sources删除
 
protobuf插件安装教程:
https://blog.csdn.net/iphone4grf/article/details/50902816
 
protobuf对应的grpc工具下载地址:
https://blog.csdn.net/y515789/article/details/54378325
 
 
问题五
中文大概意思:导入到eclipse中,就一堆报错信息

I got successful maven build.

However, this is lots of code errors in the code base. The errors are categories to four types.

  1. Eclipse complains log object does not define.
    e.g. log.info("[{}:{}] MQTT broker connection established!", configuration.getHost(), configuration.getPort());

  2. Eclipse complains final variables not initialized. "The blank final field nodeId may not have been initialized"

  3. 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.csdn.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>

相关文章
相关标签/搜索