Reputation: 83
I've tried for a while to figure out the problem with this project, but I just can't figure it out. I've setup a project in IntelliJ, set it to work with Maven, but as I'm writing the pom.xml it claims that the dependency I'm using doesn't exist.
Well, I know for a fact that the dependency code is correct, as both the GitHub and the Maven website share the same IDs and version, I can find it in mvnrepository.com, the API's GitHub and even the API's Release Note.
This is my pom.xml for anyone wondering (I've anonymized my project info)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MyGroupID</groupId>
<artifactId>ArtifactID</artifactId>
<version>1.0-SNAPSHOT</version>
<name>MyProjectName</name>
<description>ShortProjectDescription</description>
<dependencies>
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.9</version>
</dependency>
</dependencies>
</project>
Upvotes: 1
Views: 826
Reputation: 128
Since you just typed in the dependency in IntelliJ, it's yet to be downloaded and put into the external libraries folder for your project to use.
You need to reload the maven project for IntelliJ to download the dependency and then the error will go away.
Right-click on the pom file and select Maven, then select reload project:
I saw in the above comments that you wanted to enable auto-import. If you are on version v2020.1 or above, auto-import functionality has been removed. I would recommend reading this.
Also, you can use keyboard shortcuts for reloading maven:
Windows/Linux - Ctrl+Shift+O
Mac - Command + Shift + I
Upvotes: 2