如何从特定配置文件

时间:2015-09-01 18:19:11

标签: maven google-cloud-platform

在我们的pom文件中,我们有一个特殊的配置文件,允许我们将工件部署到我们的内部maven仓库以及位于google云端的外部仓库。

<distributionManagement>
        <repository>
            <uniqueVersion>false</uniqueVersion>
            <id>nexus</id>
            <name>Internal Releases</name>
            <url>http://internal_instance_ip/nexus/content/repositories/releases</url>
            <layout>default</layout>
        </repository>
        <snapshotRepository>
            <uniqueVersion>true</uniqueVersion>
            <id>nexus-snapshots</id>
            <name>Internal Snapshots</name>
            <url>http://internal_instance_ip/nexus/content/repositories/snapshots</url>
            <layout>default</layout>
        </snapshotRepository>
    </distributionManagement>

<profiles>
        <profile>
            <id>gce</id>
            <distributionManagement>
                <repository>
                    <uniqueVersion>false</uniqueVersion>
                    <id>nexus-gce</id>
                    <name>External Releases</name>
                    <url>https://gce_instance_ip/content/repositories/releases</url>
                    <layout>default</layout>
                </repository>
                <snapshotRepository>
                    <uniqueVersion>true</uniqueVersion>
                    <id>nexus-snapshots-gce</id>
                    <name>External Snapshots</name>
                    <url>https://gce_instance_ip/content/repositories/snapshots</url>
                    <layout>default</layout>
                </snapshotRepository>
            </distributionManagement>
        </profile>
    </profiles>

当我尝试部署项目时,它抱怨道:

Return code is: 413, ReasonPhrase: Request Entity Too Large.

项目有很多模块,导致问题的模块不需要部署到谷歌云。如何排除该模块部署到谷歌云仓库但仍部署到内部仓库?

1 个答案:

答案 0 :(得分:1)

您可以通过在命令行上传递以下参数来排除模块:

--projects '!module-to-exclude'

来自mvn --help

 -pl,--projects <arg>                   Comma-delimited list of specified
                                    reactor projects to build instead
                                    of all projects. A project can be
                                    specified by [groupId]:artifactId
                                    or by its relative path.

另见How to exclude a module from a Maven reactor build?