Maven 忽略存储库

Tom*_* K. 0 profile repository maven

我无法让 Maven 下载工件

    <dependency>
        <groupId>org.jboss.test-jsf</groupId>
        <artifactId>jsf-mock</artifactId>
        <version>1.1.9</version>
        <scope>test</scope>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

此依赖项不在 Maven Central 中。我已将正确的存储库添加到我的设置中。

<profiles>
    <profile>
        <id>barbucha</id>
    </profile>
    <repositories>
        <repository>
            <id>jboss</id>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <url>http://repository.jboss.org/nexus/content/groups/public/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>jboss-plug</id>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <url>http://repository.jboss.org/nexus/content/groups/public/</url>
        </pluginRepository>
    </pluginRepositories>
</profiles>
Run Code Online (Sandbox Code Playgroud)

然后我使用配置文件构建东西barbucha。然而,maven 根本不使用 JBoss 存储库。它尝试从 Central 获取缺少的依赖项。它尝试下载依赖项两次,然后失败:

[INFO] Downloading: http://repo.maven.apache.org/maven2/org/jboss/test-jsf/jsf-mock/1.1.9/jsf-mock-1.1.9.pom
[WARNING] The POM for org.jboss.test-jsf:jsf-mock:jar:1.1.9 is missing, no dependency information available
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/jboss/test-jsf/jsf-mock/1.1.9/jsf-mock-1.1.9.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project: Could not resolve dependencies for project: Could not find artifact org.jboss.test-jsf:jsf-mock:jar:1.1.9 in central (http://repo.maven.apache.org/maven2) -> [Help 1]
Run Code Online (Sandbox Code Playgroud)

这种行为对我来说非常奇怪,而且非常关键。我用谷歌搜索了很长时间,但没有找到任何可能导致问题的原因。唯一的原因可能是配置文件未激活。但那不是我的情况。

Tom*_* K. 5

哦,这很简单 - 我的设置只是格式错误:

<profiles>
    <profile>
        <id>barbucha</id>
    </profile> <<< this must be at the end (at <!-- #1 --->)
    <repositories>
    ... <!-- this part must be inside of profile -->
    </pluginRepositories>
    <!-- #1 --->
</profiles>
Run Code Online (Sandbox Code Playgroud)

我道歉。(希望它可以对某人有所帮助。)