maven stone using multi-module maven profiles specified in several specific sub-modules build a project in

In addition Reference: https://blog.csdn.net/linhao19891124/article/details/73872303

maven specified several specific sub-modules build a project in

The origin of the problem:

      A project may have multiple sub-module, which may only need to build several module in a particular case.

For example my project directory structure is as follows

myproject

|------------module_one

|------------module_two

|------------module_three

|------------module_four

|------------module_five

|------------module_six

|------------module_seven

| ------------ pom.xml

Solution one:

Example: I want to build module_three, module_five, module_seven three sub-module

Pom in the root directory with a run the following command:

mvn clean install -pl module_three,module_five,module_seven

You can also add the following parameters on the command

-am not only build module_three, module_five, module_seven three, and build other projects of these sub-module require, require refers to its parent project.

-amd not only build module_three, module_five, module_seven three, and build three-dependent module projects, such as module_other.

 

Solution two:

Add a profile, such as:

Copy the code
<profiles>      
  <profile>
            <id>patch_001</id>
            <properties>
                
            </properties>
            <modules>
                <module>module_three</module>
                <module>module_five</module>
                <module>module_seven</module>
            </modules>
        </profile>
</profiles>
Copy the code

Then run maven command:

mvn clean install -Ppatch_001 # so you can build only three sub-module

PS: I use the second method, I found in this profile is defined to be build the module, outside no longer need to build the module defined, otherwise it will follow to build out a series of definitions, I do not know what is the reason, or I have written are wrong, God knows if there any big, look to the wing.

Guess you like

Origin www.cnblogs.com/zhaoyanhaoBlog/p/11323112.html