Yeji
Yeji

Reputation: 39

Intellij Maven Dependency is not able to imported

I'm trying to import dependency with maven to Intellij. And I edited pom.xml like this:

<dependencies>
    <dependency>
        <groupId>net.dv8tion</groupId>
        <artifactId>JDA</artifactId>
        <version>4.2.0_214</version>
    </dependency>
</dependencies>
<repositories>
    <repository>
        <id>jcenter</id>
        <name>jcenter-bintray</name>
        <url>https://jcenter.bintray.com</url>
    </repository>
</repositories>

and I checked if dependencies are well added. Dependencies list

And I wrote below code in my project.

import net.dv8tion.jda.*;

public class main {
    public static void main(String args[]) {}
}

The result is.. I got error: java: package net.dv8tion.jda does not exist
I did maven Reload project and Invalidate caches and I still getting same error.
I wonder why this happens and how to fix.

Upvotes: 1

Views: 1056

Answers (1)

p_efros
p_efros

Reputation: 301

This is what worked for me: File -> Invalidate Caches/Restart, then Build -> Rebuild project

I could then import JDABuilder or other classes.

Upvotes: 2

Related Questions