Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何避免在Maven中使用具有不同配置文件的已定义镜像?_Maven_Maven 2 - Fatal编程技术网

如何避免在Maven中使用具有不同配置文件的已定义镜像?

如何避免在Maven中使用具有不同配置文件的已定义镜像?,maven,maven-2,Maven,Maven 2,我的工作项目是使用一个人工制品作为Maven的镜像。因此,~/.m2/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

我的工作项目是使用一个人工制品作为Maven的镜像。因此,
~/.m2/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">
    <servers>
        <server>
            <id>artifactory</id>
            <username>rx</username>
            <password>67CoHEdAxq6PALFzoB</password>
        </server>
    </servers>
    <mirrors>
        <mirror>
            <id>artifactory</id>
            <mirrorOf>*</mirrorOf>
            <url>https://dev.mycompany.com/artifactory/maven-all</url>
        </mirror>
    </mirrors>
</settings>
问题:使用配置文件
private
使用以下命令生成项目时:

mvn -P private archetype:generate -DgroupId=rx.practice.servlet -DartifactId=servlet -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=fa[Clse

Maven仍然试图从镜像下载插件,镜像中不包含这些插件。谁能解释为什么?以及如何修复它?

您不能使用第二个settings.xml吗?目前我正在使用另一个settings.xml,但是使用上面提到的解决方案,我遇到了这个问题。这意味着我仍然没有正确理解settings.xml中的配置。所以我还是想弄明白
mvn -P private archetype:generate -DgroupId=rx.practice.servlet -DartifactId=servlet -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=fa[Clse