How to Deploy only the sub-modules using maven deploy?

前端 未结 6 777
既然无缘
既然无缘 2021-01-31 07:48

How do i deploy only the sub-modules of the project? i have a project as;

ProjectA
 -  Submodule B
 - Submodlue C
 - Submodule D 

The submodule

相关标签:
6条回答
  • 2021-01-31 08:27

    Another suggestion could be doing the following:

    mvn deploy -pl SubModuleB
    
    0 讨论(0)
  • 2021-01-31 08:29

    This is working on my side Put the plugin declaration in the parent pom , skip=true, but set inherited=false. This prevents from repeating the on each child modules.

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
                <inherited>false</inherited>
            </plugin>
    
    0 讨论(0)
  • 2021-01-31 08:33

    Put this in module(s)(or module's pom.xml) that you don't want to deploy:

    <properties>
      <maven.deploy.skip>true</maven.deploy.skip>
    </properties>
    

    Since this is inherited by submodules, you have to put this in submodules that you do want to deploy:

    <properties>
      <maven.deploy.skip>false</maven.deploy.skip>
    </properties>
    
    0 讨论(0)
  • 2021-01-31 08:50

    You can configure the maven-deploy-plugin in the POM of a module to exclude it from the deploy:

    <build>
      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-deploy-plugin</artifactId>
         <version>2.4</version>
         <configuration>
           <skip>true</skip>
         </configuration>
       </plugin>
       ...
    </build>
    
    0 讨论(0)
  • 2021-01-31 08:54

    This worked for me. Similar to other answer except added missing plugins element. Add to parent POM.

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    0 讨论(0)
  • 2021-01-31 08:54

    You can use the technique described in my blog.

    In this case, you'd disable default-deploy (or what the name is) in the root pom.xml:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <executions>
            <execution>
                <id>default-deploy</id>
                <phase>none</phase>
            </execution>
        </executions>
    </plugin>
    

    And then enable it for submodules:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <executions>
            <execution>
                <id>default-deploy</id>
                <phase>deploy</phase>
            </execution>
        </executions>
    </plugin>
    
    0 讨论(0)
提交回复
热议问题