Maven dependencies not being found

Answered

I have recently downloaded IntelliJ on my MacBook and whenever I create a new Maven project, the project is unable to detect the dependencies in the pom.xml. Before, I was using a windows 10 laptop and everything was working fine so just wondering if anyone could help me resolve this problem because it is becoming extremely frustrating.

Thank you!

0
12 comments

Please see this answer and check the logs to see what's causing the problem: http://stackoverflow.com/a/42427510/104891.

0
Avatar
Permanently deleted user

Thanks, this seems to be the error in the logs. Any idea what it means?

2017-09-07 23:20:47,402 [3798621]   INFO -      #org.jetbrains.idea.maven - [WARNING] The metadata /Users/ollie/.m2/repository/org/spigotmc/spigot-api/1.8.8-R0.1-SNAPSHOT/maven-metadata-vault-repo.xml is invalid: entity reference name can not contain character =' (position: START_TAG seen ...com/main?ParticipantID=jqlc435patgs4w79dx7g33u8otdryt35&FailedURI=... @1:276) 

0

I doubt it's the error that prevents dependencies import. To investigate further we need more details (complete logs, sample project to reproduce, etc).

0
Avatar
Permanently deleted user

I know the maven repositories work absolutely fine because I have used them before on a windows laptop so maybe it is my settings:

https://gyazo.com/02bf4f846c2a037c36cbd7097c179ecd

https://gyazo.com/b5d1d3e05b023110973425e63e2971e5

 

And here is my complete log:

https://pastebin.com/EKtLrU0S

0

This doesn't seem to be a complete log, it has nothing related to Maven and doesn't even include IDE startup.

Try to delete .idea project directory and reimport, then provide the logs.

0
Avatar
Permanently deleted user

This should be the complete log when I open up the project:

https://pastebin.com/4tjfTrYV

0

The log has nothing related to Maven, no errors, etc. It's impossible to tell why dependencies are not resolved. Please provide a sample project.

0
Avatar
Permanently deleted user

Okay, I have created a sample class called Test. I am using the Spigot API. Within the class JavaPlugin appears in red and it says that it can't be resolved.

<repositories>
<repository>
<id>spigot-repo</id>
<url>https://repo.destroystokyo.com/repository/maven-public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

 

package me.ollie_2411.test;

public class Test extends JavaPlugin {


}
0

https://repo.destroystokyo.com/repository/maven-public/ repository doesn't provide any artifacts with org.spigotmc groupID:

Command line Maven build like `mvn package` will fail with the following:

[ERROR] Failed to execute goal on project mvnsampledep: Could not resolve dependencies for project mvnsampledep:mvnsampledep:jar:1.0-SNAPSHOT: Failure to find org.spigotmc:spigot-api:jar:1.8.8-R0.1-SNAPSHOT in https://repo.destroystokyo.com/repository/maven-public/ was cached in the local repository, resolution will not be reattempted until the update interval of spigot-repo has elapsed or updates are forced -> [Help 1]

The problem has nothing to do with IntelliJ IDEA.

https://www.spigotmc.org/wiki/bbcode.7328/archive has the different repository URL you should use. If SNAPSHOT dependency cannot be resolved, browse https://hub.spigotmc.org/nexus/#view-repositories;snapshots~browsestorage to find the exact version. The following should work:

<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-20160221.082514-43</version>
<scope>provided</scope>
</dependency>
</dependencies>
0
Avatar
Permanently deleted user

Oh wow my bad, works perfectly now. Thank you very much! Any idea why the repository I was using is working on my windows laptop and not on my macbook?

0

Your Windows laptop probably has it cached in the local .m2 repository. It could be that this dependency was removed from the online repository, so you can no longer download it on another machine and the local cache on your other machine is empty.

0
Avatar
Permanently deleted user

Ah I understand now, I should have thought of that. Thanks for your help.

0

Please sign in to leave a comment.