4

我有一个 Maven 存储库,它将所有工件存储在

http://example.com/content/public

我有第二个存储库,其中存储了不同的工件

http://example.com/content/type1

默认情况下,对于所有构建,我想从“内容/公共”获取工件

但是对于打开标志时的一个特定用例,我想从“content/type1”中获取工件

如果工件不存在,那么我想在“内容/公共”中查找它

我的 apache-maven/3.04./conf/settings.xml 看起来像这样

<mirrors>
    <mirror>
        <!-- This sends everything else to /public -->
        <id>nexus</id>
        <mirrorOf>*,!type1</mirrorOf>
        <url>http://example.com/content/public</url>
    </mirror>
</mirrors>
<profiles>

    <profile>
        <id>nexus</id>
        <!-- Enable 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></releases>
                  <snapshots><enabled>true</enabled><updatePolicy>never</updatePolicy></snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>central</id>
                <url>http://central</url>
                <releases><enabled>true</enabled></releases>
                <snapshots><enabled>true</enabled></snapshots>
            </pluginRepository>
        </pluginRepositories>

        <properties>
            <!-- Default this property so we can create references easily. -->
            <nexusHostName>example.com</nexusHostName>
        </properties>
    </profile>
</profiles>
<activeProfiles>
    <!-- make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
</activeProfiles>

我在 pom.xml 中的个人资料看起来像这样

<profile>
        <id>type1-build</id>
        <activation>
            <property>
                <name>type1</name>
                <value>true</value>
            </property>
        </activation>

        <repositories>
            <repository>
                <id>type1</id>
                <name>Type1 Repo</name>
                <url>http://${nexusHostName}/content/groups/type1/</url>
                <layout>default</layout>
                <!-- Enforce strict checksums and always update releases and snapshots -->
                <releases>
                    <enabled>true</enabled>
                    <checksumPolicy>fail</checksumPolicy>
                    <updatePolicy>always</updatePolicy>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                    <checksumPolicy>fail</checksumPolicy>
                    <updatePolicy>always</updatePolicy>
                </snapshots>
            </repository>
            <repository>
                <id>nexus</id>
                <name>Nexus</name>
                <url>http://${nexusHostName}/content/groups/public/</url>
                <layout>default</layout>
                <!-- Enforce strict checksums and always update releases and snapshots -->
                <releases>
                    <enabled>false</enabled>
                    <checksumPolicy>fail</checksumPolicy>
                    <updatePolicy>always</updatePolicy>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                    <checksumPolicy>fail</checksumPolicy>
                    <updatePolicy>always</updatePolicy>
                </snapshots>
            </repository>
        </repositories>

    </profile>

即使在我运行像 mvn goal1 -Dtype1=true 这样的目标之后这样做了,它仍然会在“content/public”中查找工件

有人可以告诉我我做错了什么吗

4

1 回答 1

0

只需先更改存储库 content/type1 的顺序,然后再更改 content/public

于 2013-07-05T14:56:15.887 回答