Maven忽略了一个存储库

时间:2015-01-16 10:59:34

标签: maven profile repository

我无法让Maven下载工件

    <dependency>
        <groupId>org.jboss.test-jsf</groupId>
        <artifactId>jsf-mock</artifactId>
        <version>1.1.9</version>
        <scope>test</scope>
    </dependency>

此依赖关系不在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>

然后我使用barbucha个人资料构建内容。但是,maven根本不使用JBoss存储库。它试图从中心获得缺少的依赖。它尝试两次下载依赖项然后失败:

[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]

这种行为非常奇怪,对我来说非常重要。我google了很长时间,但没有发现,什么可能导致问题。如果未激活,唯一的原因可能是配置文件。但那不是我的情况。

1 个答案:

答案 0 :(得分:3)

哦,这很简单 - 我的设置只是格格不入:

<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>

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