1

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.

Yeji
  • 39
  • 4
  • which version of IntelliJ are you using? – JavaMan Nov 08 '20 at 08:44
  • According to Ahmed Salem's answer for this question https://stackoverflow.com/questions/20137020/package-doesnt-exist-error-in-intellij there is a bug in IntelliJ version 2020.1 and 2020.1.1 – JavaMan Nov 08 '20 at 09:11

1 Answers1

2

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

I could then import JDABuilder or other classes.

p_efros
  • 301
  • 2
  • 11