1

in our pom file we have a special profile that allow us to deploy artifacts to both our internal maven repo as well as external one which locate on google cloud.

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

when I tried to deploy the project, it complained :

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

the project has lots of modules, the one that cause trouble doesn't need to be deployed to google cloud. How can i exclude that module from being deployed to the google cloud repo but still deployed to the internal repo?

user468587
  • 4,799
  • 24
  • 67
  • 124

1 Answers1

2

You can exclude the module by passing the following argument on the command line:

--projects '!module-to-exclude'

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

See also How to exclude a module from a Maven reactor build?

Community
  • 1
  • 1
Clauds
  • 950
  • 11
  • 24
  • tried to run the command: mvn --projects ! -Pgce clean deploy, seems didn't work, it still tried to deploy that module to google cloud – user468587 Sep 04 '15 at 19:35
  • Does the excluded module show up in the command output under 'Reactor Build Order' ? What Maven version are you using? I'm wondering if the option `--projects` resp. `-pl` could have issues in the specific version that you are using... (I'm using 3.3.3 resp. 3.2.1) – Clauds Oct 27 '15 at 18:34