拉取源码
git clone https://github.com/thingsboard/thingsboard.git
jdk11
java -version
java version "11.0.27" 2025-04-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.27+8-LTS-232)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.27+8-LTS-232, mixed mode)
IDEA集成开发工具
Lombok插件安装
Protocol Buffers插件安装
Maven镜像更新
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>mvnrepository</id>
<mirrorOf>central</mirrorOf>
<name>mvnrepository Public Repository Group</name>
<url>http://mvnrepository.com/</url>
</mirror>
<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>
</mirrors>
IDEA项目配置
maven依赖包调整支持mac M芯片
protobuf.version 调整

<protobuf.version>3.21.12</protobuf.version>
<grpc.version>1.50.2</grpc.version>
protobuf-maven-plugin 调整
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<configuration>
<!--
The version of protoc must match protobuf-java. If you don't depend on
protobuf-java directly, you will be transitively depending on the
protobuf-java version that grpc depends on.
-->
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
运行
mvn clean install
运行ThingsBoard服务main方法
修改配置文件 application/src/main/resources/thingsboard.yml
yaml
datasource:
driverClassName: "${SPRING_DRIVER_CLASS_NAME:org.postgresql.Driver}"
url: "${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/thingsboard}"
username: "${SPRING_DATASOURCE_USERNAME:postgres}"
password: "${SPRING_DATASOURCE_PASSWORD:postgres}"
hikari:
maximumPoolSize: "${SPRING_DATASOURCE_MAXIMUM_POOL_SIZE:16}"
拷贝sql
cp -r dao/src/main/resources/sql application/src/main/data
运行install

启动日志
查看pgsql数据库表是否已经创建

启动后台服务
application/src/main/java/org/thingsboard/server/ThingsboardServerApplication.java
没有报错即启动完成