Maven: property to activate profile in sub-modules

醉酒当歌 提交于 2019-11-28 11:28:23
user944849

Alas, it is not possible to do what you are trying to do. I spent hours attempting the same thing before finding this note on the Codehaus website:

Note only properties set on the Maven command line can activate profiles. Properties set in the POM, the parent POM, or other profiles have no effect.

Basically, profile activation happens very early in the POM processing, before all of the properties are interpolated. Essentially this means the property activating a profile must have a defined value at the very beginning of a build - as a system property, so on the command line - because profile activation occurs before Maven processes any <properties> elements. There is an answer to a similar StackOverflow question that gives more detail and background docs.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!