Maven - skip parent project build

前端 未结 5 1191
轮回少年
轮回少年 2020-12-06 16:30

I know it\'s mauvais ton to ask twice in a single day but here\'s another Maven puzzler:

I have a parent POM which defines 5 modules (5 subprojects). Since

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-06 16:51

    You can't skip the parent build, but you can configure the profile to not be activated with a little hack. This answer shows how to control the activation of a profile by the presence or absence of a file-based element. This way you can define the profile in the parent, but have it deactivated in that project because of the marker file being present in the parent. Child projects would not have the marker file in their source, so the profile would be activated for those projects.

    Update to clarify: On my test project this configuration means the profile is deactivated in the parent project (which has the file in src/main/resources), but activated in all child projects which do not have the file in their resources directories.

    
      test
      
        
          src/main/resources/test.marker
        
      
      ...
    
    

提交回复
热议问题