Adding maven repo in IntelliJ

前端 未结 2 1862
遥遥无期
遥遥无期 2020-12-30 02:45

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

相关标签:
2条回答
  • 2020-12-30 03:25

    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.

    0 讨论(0)
  • 2020-12-30 03:25

    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>http://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>http://repo1.maven.org/maven2</url>
          <layout>default</layout>
        </repository>
      </repositories>
    
    0 讨论(0)
提交回复
热议问题