1-ThingsBroad 源码编译(Windows)

1.准备编译环境

github地址: https://gitee.com/mirrors/ThingsBoard
gitee镜像地址: https://gitee.com/mirrors/ThingsBoard

以下环境经测试,编译成功

  • thingsboard: 3.3.2版本
  • jdk: 11.0.11.9 (其他版本暂时测试不成功
  • maven: 3.8.2
  • node: 14.17.5
  • npm: 6.14.14
  • yarn: 1.22.11

1.2 JDK 配置环境变量

1.3 maven

  • 下载安装(推荐单独安装)

新建repository,在apache-maven-3.8.2\conf\settings.xml下配置repository路径和镜像

D:\\DEV\\maven\\apache-maven-3.8.2-bin\\repository

  
    
              
      central         
      aliyun central         
      https://maven.aliyun.com/repository/central
      central
    
             
      google         
      aliyun google         
      https://maven.aliyun.com/repository/google
      google
    
             
      public         
      aliyun public         
      https://maven.aliyun.com/repository/public
      public
    
             
      gradle-plugin         
      aliyun gradle-plugin         
      https://maven.aliyun.com/repository/gradle-plugin
      gradle-plugin
    
             
      spring         
      aliyun spring         
      https://maven.aliyun.com/repository/spring
      spring
    
             
      spring-plugin         
      aliyun spring-plugin         
      https://maven.aliyun.com/repository/spring-plugin
      spring-plugin
     
             
      grails-core         
      aliyun grails-core         
      https://maven.aliyun.com/repository/grails-core
      grails-core
    
             
      apache-snapshots         
      aliyun apache-snapshots         
      https://maven.aliyun.com/repository/apache-snapshots
      apache-snapshots
    
    
      mirrorId
      repositoryId
      Human Readable Name for this Mirror.
      http://my.repository.com/repo/path
    
  

  • 配置maven环境变量
  • IDEA中需要设置maven配置


1.4 node安装、配置环境变量

1.5 idea 设置

1.5.1 注释掉 pom 文件 license 检查

项目根目录pom.xml

1.5.2 安装插件 IntelliJ Lombok plugin 和 Protobuf Support;

1.5.3 设置IDEA Java编译环境





2.编译

以上准备工作做完了,使用以下命令在项目根目录下进行编译,多试几次

mvn clean install -DskipTests

mvn clean package install '-Dmaven.test.skip=true'

或 直接使用idea maven 的compile

2.1可能出现的问题

  • 中途如果遇到某个子模块编译错误,可单独编译子模块查找问题,这样不必从头开始编译浪费时间。
  • 可能会遇到前端子模块问题,例如编译过程中提示yarn install 报错,可以在该子模块根目录下,执行yum install -g 进行安装

3. 初始化数据库、导入数据

3.1 安装postgres

测试环境,使用docker安装,账号密码均为postgres,端口号5432,新建thingsboard库,和项目默认保持一致。

2.2导入数据

在ThingsBoard-master\application\target\下根据编译环境在windows或其他环境选择执行不同的脚本,

方式1:执行:windows下的install_dev_db.bat 命令即可完成测试数据导入。
方式2:ThingsBoard初始化数据库 - (jianshu.com)

以上步骤如果顺利,启动项目即可运行thingsboard服务,访问localhost:8080即可进入项目前端
默认账号密码:
系统管理员: [email protected] / sysadmin
租户管理员: [email protected] / tenant
客户: [email protected] / customer

你可能感兴趣的:(1-ThingsBroad 源码编译(Windows))