How to import class from my maven dependency

Viewed 400

I have a maven dependency in my pom.xml file. I want to use the classes in the dependency. The dependency is a local thing. Somehow IDEA does not recognize and does not support import class or anything like that when I type the class name I want to use.

In MyLibrary i ran mvn clean install and I did that also after I added my dependency to the target project.

 <dependency>
  <groupId>org.example</groupId>
  <artifactId>MyLibrary</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>
1 Answers

If you type the class name (jackson) in your code and hit ctrl + space, Eclipse will suggest matches and automatically import the one you select.

Ex:

import org.glassfish.jersey.jackson.*;
Related