26

I'm having trouble adding this repo http://repo1.maven.org/maven2/ under Settings > Maven > Repositories. It also says Nexus Service or Artifactory URL. How can I check if the URL is one of these types?

http://repo1.maven.org/maven2/ is the URL I use in NetBeans for Maven, and it works there.

Joelmob
  • 1,076
  • 2
  • 10
  • 22

2 Answers2

22

This repository is already used by default and is hardcoded, you don't need to add it manually. If you want to use any other repository, the easiest way would be to define it directly in the pom.xml file or in your settings.xml. In either way IDEA will load these settings automatically.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • Apparently they were there but the when I wanted to create a module from an archetype jersey-grizzly2 I had to add it manually with add archetype button – Joelmob May 20 '12 at 21:17
  • 2
    But still abit confusing, when i tried to add the repo manually in settings, it said it found 0 repos. And when i try to create a new module with an archetype it just fails and says the archetype can't be found. I give up. – Joelmob May 20 '12 at 21:29
  • Ignore my previous comments! I had just forgot a tiny word in groupId – Joelmob May 20 '12 at 21:51
3

On windows, add repo as a mirror on this file C:\Users\{user}\.m2\settings.xml

<settings>
  ...
  <mirrors>
    <mirror>
      <id>other-mirror</id>
      <name>Other Mirror Repository</name>
      <url>https://repo1.maven.org/maven2</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>
  ...
</settings>

OR

Add the <repositories> tag in the <project>

  <repositories>
    <repository>
      <releases>
        <enabled>false</enabled>
        <updatePolicy>always</updatePolicy>
        <checksumPolicy>warn</checksumPolicy>
      </releases>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
        <checksumPolicy>fail</checksumPolicy>
      </snapshots>
      <name>Nexus Snapshots</name>
      <id>snapshots-repo</id>
      <url>https://repo1.maven.org/maven2</url>
      <layout>default</layout>
    </repository>
  </repositories>
Piaget Hadzizi
  • 702
  • 8
  • 15