I'm having trouble adding Google Guava to my IntelliJ project. I've tried the following:
-
From
pom.xml
, using ALT–INSERT and selecting "Dependency". I tried searching for "google", "guava", and "google-guava". There were no results for any of these searches. -
The guava website suggests that guava can be found in "Maven Central." I think that is
http://repo1.maven.org/maven2/
. I tried adding that URL to the list at Project Settings->Maven->Repositories. If I add it to the "Artifactory or Nexus Service URLs" list, when I click "Test" I get the message "No repositories found." I cannot find a way to add the URL to the list of "Indexed Maven Repositories" (which only has an "Update" button). -
I tried adding this
<dependency>
snippet directly topom.xml
<dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>10.0.1</version> </dependency>
but
com.google.guava
gets highlighted in red with a tooltip saying that dependency cannot be found.
How can I get IntelliJ to add Guava as a maven dependency for my project (without downloading it myself)?
Edit
The Maven Repositories that IntelliJ is already configured with are:
- http://oss.sonatype.org/service/local/
- http://repo.jfrog.org/artifactory/api/
- http://repository.jboss.org/nexus/service/local/
The only entry in my "Indexed Maven Repositories" is a local directory:
- /home/benw/.m2/repository
Best Answer
this is what is working for me without any special configuration for IntelliJ with
auto-import
turned on for all my Maven projects. Without auto-import you have to tell IntelliJ to manually resolve thepom.xml
changes.Make sure you are not overriding the defaults in the
pom.xml
or the~/.m2/settings.xml
with a mirrors or other incorrect repository declarations.