12

I created a Java Gradle project in IntelliJ IDEA 15.0.3. But I am getting the following error.

Unindexed remote maven repositories found. Disable...
        The following repositories used in your gradle projects were not indexed yet: 
        http://repo1.maven.org/maven2
        If you want to use dependency completion for these repositories artifacts,
        Open Repositories List, select required repositories and press "Update" button (show balloon)

When I open the repositories list and click update, I am getting the following error

java.lang.RuntimeException: java.io.IOException: Transfer for nexus-maven-repository-index.properties failed
Ram Vibhakar
  • 255
  • 2
  • 5
  • 19
  • Possible duplicate of [Intellij Community can't use http proxy for Maven](http://stackoverflow.com/questions/1784132/intellij-community-cant-use-http-proxy-for-maven) –  Feb 03 '16 at 04:05
  • I had the same problem and wrote an answer here: http://stackoverflow.com/questions/32037082/unindexed-remote-maven-repositories-in-intellij-idea-14 – Spenhouet Dec 22 '16 at 16:57

3 Answers3

7

In your build.gradle repositories section replace mavencentral() with another mirror, like so:

repositories {
    maven {
        url "http://uk.maven.org/maven2"
    }
}

then when you get the "Unindexed remote maven repositories found" go to the repositories view and press update. that should do it

jsaddwater
  • 1,781
  • 2
  • 18
  • 28
5

A possible (though not the only cause for this issue is, that you are behind a firewall that is blocking your connection). In this case you may need to configure a proxy server for Maven.

In my case it helped to just create a new file named settings.xml with the following contents and place it under C:\Users\<username>\.m2\ (or ~/.m2 on linux):

<settings>
  <proxies>
    <proxy>
      <id>HTTP proxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>REPLACE_BY_IP_OR_HOSTNAME</host>
      <port>REPLACE_BY_PORT_NUMBER</port>
    </proxy>

    <proxy>
      <id>HTTPS proxy</id>
      <active>true</active>
      <protocol>https</protocol>
      <host>REPLACE_BY_IP_OR_HOSTNAME</host>
      <port>REPLACE_BY_PORT_NUMBER</port>
    </proxy>
 </proxies>
</settings>

Replace host and port for your specific environment.

lanoxx
  • 12,249
  • 13
  • 87
  • 142
  • 1
    Thank you! This was the ticket for me! Also, the full reference for the proxy settings is here: https://maven.apache.org/settings.html – John L May 13 '17 at 15:13
  • @lanoxx where can i find HOSTNAME & PORT_NUMBER required – Shasu May 10 '23 at 12:33
  • If you are behind a proxy, for example because you are in a corporate environment, a school, a university, etc., then you would usually get this information from your organization or the local IT department, there are also way to discover this from your PC's proxy configuration if you know where to look for (there are already other SO answers which discuss that). – lanoxx May 11 '23 at 09:48
1

Adding proxy settings to VM options worked. This answer helped me to set the proxy settings on IntelliJ for Maven

Community
  • 1
  • 1
Ram Vibhakar
  • 255
  • 2
  • 5
  • 19