概述
ThingsBoard从3.2.2之后将JDK更新到11版本,相较于之前的版是一个极大的更新,本着人人为我、我为人人的精神为了让其它小伙伴在本次升级中少走一些弯路,特把我自己的方法分享出来。
拉取源码
1
git clone https://github.com/thingsboard/thingsboard.git
开发环境
- java
1
2
3
4
C:\Users\Administrator>java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
- node
1
2
C:\Users\Administrator>node -v
v12.22.1
- yarn安装
1
2
3
npm install -g yarn
yarn config set registry https://registry.npm.taobao.org -g
yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g
工具
- IDEA集成开发工具
- Lombok插件安装
- Protocol Buffers插件安装
- PostgreSQL
- 使用PostgreSQL 12.X及以上版本
Maven镜像更新
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<mirror>
<id>central</id>
<name>aliyun central</name>
<url>https://maven.aliyun.com/repository/central</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>google</id>
<name>aliyun google</name>
<url>https://maven.aliyun.com/repository/google</url>
<mirrorOf>google</mirrorOf>
</mirror>
<mirror>
<id>public</id>
<name>aliyun public</name>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>public</mirrorOf>
</mirror>
<mirror>
<id>gradle-plugin</id>
<name>aliyun gradle-plugin</name>
<url>https://maven.aliyun.com/repository/gradle-plugin</url>
<mirrorOf>gradle-plugin</mirrorOf>
</mirror>
<mirror>
<id>spring</id>
<name>aliyun spring</name>
<url>https://maven.aliyun.com/repository/spring</url>
<mirrorOf>spring</mirrorOf>
</mirror>
<mirror>
<id>spring-plugin</id>
<name>aliyun spring-plugin</name>
<url>https://maven.aliyun.com/repository/spring-plugin</url>
<mirrorOf>spring-plugin</mirrorOf>
</mirror>
<mirror>
<id>grails-core</id>
<name>aliyun grails-core</name>
<url>https://maven.aliyun.com/repository/grails-core</url>
<mirrorOf>grails-core</mirrorOf>
</mirror>
<mirror>
<id>apache-snapshots</id>
<name>aliyun apache-snapshots</name>
<url>https://maven.aliyun.com/repository/apache-snapshots</url>
<mirrorOf>apache-snapshots</mirrorOf>
</mirror>
<!-- 中央仓库1 -->
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://insecure.repo1.maven.org/maven2/</url>
</mirror>
项目配置
-
SDKs
-
Project
-
Run
运行
-
maven install
-
运行ThingsBoard服务main方法
-
输出结果
异常处理
- Error running ‘ThingsboardServerApplication’: Command line is too long. Shorten command line for ThingsboardServerApplication or also for Application default configuration直接在下workspace.xml中的PropertiesComponent节点下面添加如下代码:
1
<property name="dynamic.classpath" value="true" />
总结
- 本次的Maven镜像全部采用aliyun即可;
- 安装yarn
- 前端镜像采用taobao
- fetched-v12.18.1-linux-x64和fetched-v12.18.1-win-x64这两个文件在电脑C:\Users\Administrator/.pkg-cache\v2.6下面,由于文件较大可以先行下载并放入目录中
- 在IDEA里Run mvn install没有通过,原因是yarn导致,我最终采用终端运行mvn clean install -DskipTests命令
结束语
过程还是比较艰辛希望各位小伙伴能顺利通过,下面把我所有知道关于ThingBoard的技术交流群都放在下面。
添加好友拉你进群(备注:张三-技术交流):
由于群成员有限制,请勿同时加入两个群
ThingsBoard物联网技术交流群: