In Maven, can a profile override the modules (to not include any)

前端 未结 3 487
孤街浪徒
孤街浪徒 2021-01-11 16:39

In maven, once you define your modules in you pom.xml all profiles aggregate the modules defined in them: (relevant part only)

3条回答
  •  执笔经年
    2021-01-11 17:06

    It's not possible. Profile configuration is always merged with main configuration, so you only can add modules in your case.

    What you can do instead, however, is to create a some kind of "default" profile (by true in section) that is enabled when no other profiles are invoked and put your default modules' list there. Then, when no profile is specified on Maven build call, this "default" profile is used, but when you call explicitly at least one profile, it's not, so you can this way define modules' list from scratch.

提交回复
热议问题