Ridha Kchouk
Ridha Kchouk

Reputation: 75

How to add and artifact located at openhab repository with Maven?

I am looking to add a dependency to my pom.xml file

The dependency is a library allowing to manipulate Bluetooth Low Energy devices. Here is the link : TinyB

Here is also the github of the library : intel-iot-devkit/tinyb

When I copy and paste the snippet code to add the dependency, I get the following error after Maven tries to resolve the dependencies :

Could not find artifact intel-iot-devkit:tinyb:pom:0.5.1 in central (https://repo.maven.apache.org/maven2)

Could this be because the artifact is located in the OpenHab repository ? Then if this may cause the problem, how to solve it ?

Here is a copy of my pom.xml file :

  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.HAcare</groupId>
    <artifactId>HAcare_Connector</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>15.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>15.0.1</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>

    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.6</version>
                <executions>
                    <execution>
                        <!-- Default configuration for running -->
                        <!-- Usage: mvn clean javafx:run -->
                        <id>default-cli</id>
                        <configuration>
                            <mainClass>org.HAcare.App</mainClass>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

And here is the code snippet I added to pom.xml :

<dependency>
    <groupId>intel-iot-devkit</groupId>
    <artifactId>tinyb</artifactId>
    <version>0.5.1</version>
</dependency>

Upvotes: 0

Views: 260

Answers (1)

Ridha Kchouk
Ridha Kchouk

Reputation: 75

There is a second repository where it is possible to use this library by adding a dependency to the pom.xml file. Indeed it seems that the libraries are stored on the repository of openHAB.

To proceed you must first :

  1. Add a repositories section in the pom.xml file

Here is a snippet code:

 <repositories>
        <repository>
            <id>openHAB</id>
            <name>openHabTinyB</name>
            <url>https://openhab.jfrog.io/openhab/libs-release/</url>
        </repository>
    </repositories>
  1. You have to add the following dependency:

Here is a snippet code:

        <!-- https://mvnrepository.com/artifact/org.openhab.osgiify/intel-iot-devkit.tinyb -->
        <dependency>
            <groupId>org.openhab.osgiify</groupId>
            <artifactId>intel-iot-devkit.tinyb</artifactId>
            <version>0.5.1</version>
        </dependency>

Upvotes: 2

Related Questions