由於thingsboard都是國外的資料,國內基本沒有參考資料。因此,記錄下來源碼安裝當中,遇到的問題。java
thingsboard官網源碼安裝鏈接:node
mvn clean install -DskipTests
這一步的時候,報一下錯誤:
<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聲明,因此報錯,沒法執行下去。
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
![](http://static.javashuo.com/static/loading.gif)
修改根目錄下的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.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>