在 Idea Intellij 中使用 Nexus 存储库而不是 public Maven

Using Nexus repository instead of public Maven in Idea Intellij

如何强制 Idea Intellij 从 Nexus 存储库而不是 Maven Public 存储库下载? 我在哪里可以在 Idea 属性中配置它? 它没有在 pom.xml 文件中定义,我不想定义。

不确定它是否也适用于 Idea Intellij(我正在使用 spring source studio - eclipse clon),但应该是因为 maven 配置位于 .M2 目录中的 settings.xml在您的主目录中。只需使用这样的东西(我的服务器在 nexus-server:8081 上是 运行):

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <servers>
    <server> 
      <id>releases</id>
      <username>user-name</username>
      <password>your-password</password>
    </server>
    <server> 
      <id>snapshots</id>
      <username>user-name</username>
      <password>your-password</password>
    </server>
  </servers>
    <mirrors>
        <mirror>
            <!--This sends everything else to /public -->
            <id>nexus</id>
            <mirrorOf>*</mirrorOf>
            <url>http://nexus-server:8081/nexus/content/groups/public</url>
        </mirror>
    </mirrors>
    <profiles>
        <profile>
            <id>nexus</id>
            <!--Disable snapshots for the built in central repo to direct -->
            <!--all requests to nexus via the mirror -->
            <repositories>
                <repository>
                    <id>central</id>
                    <url>http://central</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>central</id>
                    <url>http://central</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>
    <activeProfiles>
        <!--make the profile active all the time -->
        <activeProfile>nexus</activeProfile>
    </activeProfiles>
</settings>