Maven TinyB失败:软件包tinyb不存在

时间:2018-08-20 23:41:48

标签: java maven jar bluetooth

我正在尝试使用Aws sdk和TinyB库编写一个程序。出于这个原因,我决定使用maven创建项目并解决依赖关系。但是,我一直在尝试使用TinyB软件包编译该项目超过一个星期,但没有成功。如果有人能教我我在做什么错,我将不胜感激。

我收到的失败消息如下:

  

C:/Users/fran/Desktop/RSSI_AWS_PROJECT/BleDistanceMeasurement/src/main/java/org/tfm/app/BleMng.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 dependencie scan

Project dependencies

我从这里下载并编译了TinyB库:

https://github.com/intel-iot-devkit/tinyb

但是没有直接来自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>

这在编译时给我带来了问题,好像没有下载存储库。但是带有广口瓶的饲料存在(它显示了前面引用的错误)。

我已经用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:本机库已过期。请更新本机库。       在tinyb.BluetoothManager.getBluetoothManager(BluetoothManager.java:317)

非常感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

我看到您也在尝试使用蚀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>
相关问题