Maven从Wrong存储库获取

时间:2017-03-21 15:42:03

标签: maven

我对Maven有疑问。我无法从服务器Nexus安装中下载文件。它总是尝试从“https://repo.maven.apache.org/maven2”下载,但此存储库不会出现在我的settings.xml中 如果我使用“mvn -x”运行Maven,我可以看到Maven从正确的位置读取Settings.xml。 我看不出我的错误在哪里了

这是我的Settings.xml:

<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
                      https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>C:\Users\user74679\.m2\repository</localRepository>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers>
    <server>
        <id>NexusRepo</id>
        <username>USER</username>
        <password>PASSWORD</password>
        <filePermissions>664</filePermissions>
        <directoryPermissions>775</directoryPermissions>
        <configuration/>
    </server>
</servers>

<mirrors>
    <mirror>
        <id>maven.org</id>
        <name>Maven Repo1</name>
        <url>https://repo1.maven.org/maven2/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
</mirrors>
<proxies/>
<profiles>
    <profile>
        <id>artifactory</id>
        <repositories>
            <repository>
                <id>NexusRepo</id>
                <name>libs-releases</name>
                <url>https://10.0.0.8/nexus/content/repositories/Release</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
            </repository>
            <repository>
                <id>MavenRepo</id>
                <name>libs-releases</name>
                <url>https://repo1.maven.org/maven2/</url>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
            </repository>               
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>central</id>
                <name>plugins-releases</name>
                <url>https://10.0.0.8/nexus/content/repositories/Release/</url>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>
    </profile>
</profiles>
<activeProfiles>
    <activeProfile>artifactory</activeProfile>
</activeProfiles>

1 个答案:

答案 0 :(得分:0)

可能是您的pom或某些父pom中定义了存储库。如果您想避免这种情况,请在您自己的Nexus中定义存储库组,向其添加所有相关存储库,然后镜像该组的所有(即在镜像设置中使用*)。