First search for your artifact with a groupId.

then paste it into in your pom.xml

For example

<dependency>
    <groupId>com.leibnix</groupId>
    <artifactId>binarytree</artifactId>
    <version>0.0.3</version>
</dependency>


You must copy and paste in the dependencies section

<project>
<dependencies>
… HERE
</dependencies>
</project>

Save your pom so that the dependency is downloaded in ~/.m2/repository

Then in a part of your code import the object

import com.leibnix.BinaryTree;

Ready, you can now use the object “BinaryTree” in your code

Example:

package com.example.services;

import org.apache.logging.log4j.LogManager;

import org.apache.logging.log4j.Logger;

import org.springframework.stereotype.Service;

import com.leibnix.BinaryTree;

@Service

public class BinaryTreeService {

private static final Logger log = LogManager.getLogger(BinaryTreeService.class);

public int getBinaryTreeHeight() {

BinaryTree<String> b = new BinaryTree<String>();

b.add("a");

b.add("b");

log.info("two items");

return b.getHeight();

}

}