物联网平台Thingsboard3.2.1源码编译记录

1.开发环境

JDK1.8

Postgresql 11

Node.js

Yarn 

Maven 3.6.3

Git

Idea

Redis

 2.克隆源码

git clone https://github.com/thingsboard/thingsboard.git

下载后进到thingsboard文件夹,git checkout到指定的版本,这里切换到thingsboardv3.2.1版本,对应的是java8。

3.编译安装

编译前先做一些准备工作,不然可能遇到各种莫名其妙的错误。

1.node和yarn版本与源码pom.xml中的版本号对应上,避免有些包下载不下来报错,可以下载nvm工具,方便切换不同的node版本,thingsboard3.2.1对应的版本号如下:

v12.16.1

v1.22.4

如果不想更换nodejs版本,在ui-ngxpom.xml,msa模块下 js-executor、web-ui子模块中的pom.xml三处将node修改为本地版本,3.2.1对应的nodejs版本在12~14之间,node版本高了编译会报错。

2.在根目录的pom文件中找到license-maven-plugin,将整个plugin内容注释掉,以免后续License 检查报错。

3.修改maven安装目录下conf里的settings.xml配置文件,将镜像修改为以下内容:


      nexus-public-snapshots
      public-snapshots
     http://maven.aliyun.com/nexus/content/repositories/snapshots/
    
	
      nexus
      internal nexus repository
      https://repo.maven.apache.org/maven2
      central
    

	
      maven-central
	  central
	  https://repo1.maven.org/maven2/
      central
    

    
      uk
      central
      Human Readable Name for this Mirror.
      http://uk.maven.org/maven2/
    

    
      CN
      OSChina Central
      http://maven.oschina.net/content/groups/public/
      central
    

4.在C盘用户目录下,.pkg-cach.v2.6里添加对应的文件

物联网平台Thingsboard3.2.1源码编译记录

 github下载地址:Release v2.6 · vercel/pkg-fetch · GitHub

物联网平台Thingsboard3.2.1源码编译记录

下载linux和win版本两个文件到本地,下载后重命名为fetched-v12.16.1-win-x64;fetched-v12.16.1-linux-x64,保证和本地nodejs版本一致,如下图:

物联网平台Thingsboard3.2.1源码编译记录

5.进入thingsboard 文件夹,执行下面的编译命令

mvn clean install -DskipTests 

 编译时间比较长,遇到网络问题下载失败,可以连接外网或者手机热点,编译成功信息如下:

 [INFO] ————————————————————————
[INFO] Reactor Summary for Thingsboard 3.2.1:
[INFO]
[INFO] Thingsboard …………………………………. SUCCESS [  0.240 s]
[INFO] Netty MQTT Client ……………………………. SUCCESS [  0.746 s]
[INFO] Thingsboard Server Commons ……………………. SUCCESS [  0.023 s]
[INFO] Thingsboard Server Common Data ………………… SUCCESS [  0.900 s]
[INFO] Thingsboard Server Common Utils ……………….. SUCCESS [  0.075 s]
[INFO] Thingsboard Server Common Messages …………….. SUCCESS [  1.919 s]
[INFO] Thingsboard Actor system ……………………… SUCCESS [  0.086 s]
[INFO] Thingsboard Server Stats ……………………… SUCCESS [  0.107 s]
[INFO] Thingsboard Server Queue components ……………. SUCCESS [  6.500 s]
[INFO] Thingsboard Server Commons ……………………. SUCCESS [  0.026 s]
[INFO] Thingsboard Server Common Transport components ….. SUCCESS [  1.872 s]
[INFO] Thingsboard MQTT Transport Common ……………… SUCCESS [  0.260 s]
[INFO] Thingsboard HTTP Transport Common ……………… SUCCESS [  0.130 s]
[INFO] Thingsboard CoAP Transport Common ……………… SUCCESS [  0.120 s]
[INFO] Thingsboard Server Common DAO API ……………… SUCCESS [  0.198 s]
[INFO] Thingsboard Extensions ……………………….. SUCCESS [  0.025 s]
[INFO] Thingsboard Rule Engine API …………………… SUCCESS [  0.153 s]
[INFO] Thingsboard Server DAO Layer ………………….. SUCCESS [  0.634 s]
[INFO] Thingsboard Rule Engine Components …………….. SUCCESS [  0.659 s]
[INFO] Thingsboard Server Transport Modules …………… SUCCESS [  0.023 s]
[INFO] Thingsboard HTTP Transport Service …………….. SUCCESS [ 14.392 s]
[INFO] Thingsboard MQTT Transport Service …………….. SUCCESS [ 12.769 s]
[INFO] Thingsboard CoAP Transport Service …………….. SUCCESS [ 12.785 s]
[INFO] ThingsBoard Server UI ………………………… SUCCESS [01:12 min]
[INFO] Thingsboard Server Tools ……………………… SUCCESS [  0.153 s]
[INFO] Thingsboard Rest Client ………………………. SUCCESS [  0.117 s]
[INFO] ThingsBoard Server Application ………………… SUCCESS [ 25.174 s]
[INFO] ThingsBoard Microservices …………………….. SUCCESS [  0.019 s]
[INFO] ThingsBoard Docker Images …………………….. SUCCESS [  0.684 s]
[INFO] ThingsBoard JavaScript Executor Microservice ……. SUCCESS [01:12 min]
[INFO] ThingsBoard Web UI Microservice ……………….. SUCCESS [ 19.659 s]
[INFO] ThingsBoard Node Microservice …………………. SUCCESS [  0.136 s]
[INFO] ThingsBoard Transport Microservices ……………. SUCCESS [  0.016 s]
[INFO] ThingsBoard MQTT Transport Microservice ………… SUCCESS [  0.088 s]
[INFO] ThingsBoard HTTP Transport Microservice ………… SUCCESS [  0.092 s]
[INFO] ThingsBoard COAP Transport Microservice ………… SUCCESS [  0.086 s]
[INFO] ThingsBoard Black Box Tests …………………… SUCCESS [ 22.715 s]
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time:  04:29 min
[INFO] Finished at: 2022-09-05T13:20:23+08:00
[INFO] ————————————————————————

基本的环境安装或者遇到更多编译错误可以参考下面的文章:Thingsboard入门教程:本地环境搭建和源码编译安装,献给thingsboard编译失败的同学,教程不断优化 · 物联网技术社区-物联网平台-ThingsBoard

编译成功后,配置好数据库,就可以成功运行啦。

本文章来源于互联网,如有侵权,请联系删除!原文地址:物联网平台Thingsboard3.2.1源码编译记录