DJElbow
DJElbow

Reputation: 3483

Intellij Maven Cannot Resolve Dependencies

Using Intellij 15.0.1 I am trying to build a project using Maven. However, it is not resolving any dependencies. For example using the dependency below in my pom.xml:

<dependency>
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-core_2.10</artifactId>
    <version>1.3.1</version>
</dependency>

I see a message at the bottom of Intellij saying Cannot Resolve Dependency. The folder ~/.m2/repository/org/apache/spark/spark-core_2.10/1.3.1 is still created in my maven repo, but there is no jar there. Just the files_maven.repositories spark-core_2.10-1.3.1.pom spark-core_2.10-1.3.1.pom.sha1.

This behaviour is happening with any new dependency I add to the pom.

Upvotes: 0

Views: 3538

Answers (1)

DJElbow
DJElbow

Reputation: 3483

Was able to fix the problem. Some of the directories in ~/.m2/repository were owned by root (probably from using sudo at some point). Was also seeing an error along the lines of Can't create directory at location ~/.m2/... when running mvn package from the command line.

sudo chown -R myuser:myuser ~/.m2/repository/  

After running this, Maven works in Intellij once again.

Upvotes: 1

Related Questions