我正在尝试做一个程序,我需要使用Aws sdk和TinyB库。因此,我决定使用maven来创建项目并解决依赖关系。然而,我已经尝试用TinyB包编译项目一个多星期了,但没有成功。如果有人能告诉我我做错了什么,我将非常感激。
我收到的失败信息如下。
C:UsersfranDesktopRSSI_AWS_PROJECTBleDistanceMeasurementsrcmainjavaorgtfmappBleMng.java:[7,1]包tinyb不存在。
而我的pom.xml是。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.tfm.app</groupId>
<artifactId>BleDistanceMeasurement</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>BleDistanceMeasurement</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.327</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-iot</artifactId>
<version>1.10.34</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-iot-device-sdk-java</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-iot-device-sdk-java-samples</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.kura</groupId>
<artifactId>tinyb</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>tinyb</id>
<url>https://repo.eclipse.org/content/groups/releases/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
我已经用Eclipse IDE打开了项目,想知道发生了什么,但我看到eclipse正确地识别了依赖关系。
TinyB库我已经从这里下载并编译了源码。
https:/github.comintel-iot-devkittinyb。
但是没有直接从intel下载的maven仓库,所以我加了eclipse kura这个表格。
<!-- https://mvnrepository.com/artifact/org.sputnikdev/bluetooth-manager-tinyb -->
<dependency>
<groupId>org.sputnikdev</groupId>
<artifactId>bluetooth-manager-tinyb</artifactId>
<version>1.0</version>
</dependency>
这个在编译时给我带来了问题,好像仓库没有被下载。但是带有jar的foder是存在的(它显示了前面引用的错误)。
我用TinyB做了一些小程序,它们工作得很完美,所以程序是正确编译和安装的。问题是我没有在这些小程序中使用maven(我只是在执行时添加导入并指向.jar)。像这样。
sudo java -cp examples/java/HelloTinyB.jar:/usr/lib/lib/java/tinyb.jar HelloTinyB
我还尝试了另一个maven仓库。
<!-- https://mvnrepository.com/artifact/org.sputnikdev/bluetooth-manager-tinyb -->
<dependency>
<groupId>org.sputnikdev</groupId>
<artifactId>bluetooth-manager-tinyb</artifactId>
<version>1.3.2</version>
</dependency>
在这种情况下,它可以识别依赖关系并进行编译。问题是当我尝试执行程序时,它给出了错误信息。
java.lang.RuntimeException: Native library is out of date. 请更新本地库。在 tinyb.BluetoothManager.getBluetoothManager (BluetoothManager.java:317)
非常感谢您的帮助。
我看到你也在尝试使用eclipse Kura,你实现了它的工作吗?
我也有同样的问题。
顺便说一下,我看到也许你的依赖关系并不是真的有效,因为sputnikdev有一个库在tinyB之上,但是,最后我的问题和你一样。这些是我的主要依赖项。
<!-- https://mvnrepository.com/artifact/org.sputnikdev/org.eclipse.smarthome.binding.bluetooth.transport.tinyb -->
<dependency>
<groupId>org.sputnikdev</groupId>
<artifactId>bluetooth-manager</artifactId>
<version>1.5.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/intel-iot-devkit/tinyb -->
<dependency>
<groupId>intel-iot-devkit</groupId>
<artifactId>tinyb</artifactId>
<version>0.5.1</version>
</dependency>
<dependency>
<groupId>org.sputnikdev</groupId>
<artifactId>bluetooth-manager-tinyb</artifactId>
<version>1.3.3</version>
</dependency>