Building Integration
Overview
Integration is the primary means by which Beaver IoT achieves device connectivity, device control, and functionality extension. It enables Beaver IoT to interact with other software, devices, and third-party platforms. Beaver IoT integrations fostering community co-creation and promoting system expansion and integration.
In this chapter, we will introduce the entire process of using our provided integration development repository and environment for project construction, development, debugging, and release.
Project Construction
Code Repository
We provide an integration development repository that includes all released integrations, sample code, and debugging environments. You can download the beaver-iot-integrations code repository to experience integration development.
pom.xml Configuration
- Dependency References
For integration development, we provide the context dependency package for basic integration development functions. Typically, we do not need to package context into the integration, so we set its scope to provided. Developers can introduce other dependency packages (not included in the Beaver IoT) as needed for integration development.
<dependencies>
<dependency>
<groupId>com.milesight.beaveriot</groupId>
<artifactId>context</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
Please note, to avoid dependency conflicts and duplicate package imports, we recommend developers choose dependency packages already included in the Beaver IoT platform. For packages already included in the platform, developers can set the scope to provided.
- Unified Dependency Versions
To unify dependency versions, the Beaver IoT platform defines a
beaver-iot-parentPOM dependency. Developers can define dependency versions independencyManagement.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.milesight.beaveriot</groupId>
<artifactId>beaver-iot-parent</artifactId>
<version>${beaver-iot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
In the beaver-iot-integrations project, we have already defined the version number of beaver-iot-parent, so developers do not need to define it specifically during integration development.
- Integration Packaging
The integration needs to be packaged into jar packages to be deployed for use at Beaver IoT. We recommend that developers use the
maven-assembly-pluginplugin for packaging.
<build>
<plugins>
<!-- in case you have your own dependencies to be packaged -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>