【问题标题】:how to exclude artifact from deploy in specific profile如何从特定配置文件中的部署中排除工件
【发布时间】:2015-09-01 18:19:10
【问题描述】:

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

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

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

【问题讨论】:

    标签: maven google-cloud-platform


    【解决方案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?

    【讨论】:

    • 尝试运行命令:mvn --projects ! -Pgce clean deploy,似乎没有用,它仍然试图将该模块部署到谷歌云
    • 排除的模块是否显示在“反应堆构建顺序”下的命令输出中?您使用的是什么 Maven 版本?我想知道选项--projects 是否。 -pl 可能在您使用的特定版本中存在问题...(我使用的是 3.3.3 和 3.2.1)
    猜你喜欢
    • 1970-01-01
    • 2016-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-10
    • 2017-12-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多