将 -f 选项引入多模块
maven 中有 -f
选项,允许指定备用 pom.xml
文件。我是否有可能也可以将此行为带到执行的模块中?现在看起来,当我有这个结构时:
projectA: pom.xml pom.xml2
projectB: pom.xml pom.xml2
And when I run maven with -f pom.xml2
option as reactor with projectB specified as module, it looks like that it picks pom.xml2
from the projectA, and it picks pom.xml
from projectB. Is there a way, how can I propagate the -f
option to the modules?Thanks for answering.
there is -f
option in maven, that allows to specify alternate pom.xml
file. Is there a possibility, that I can also bring this behaviour to the executed modules? Now it looks like, that when I have this structure:
projectA: pom.xml pom.xml2
projectB: pom.xml pom.xml2
And when I run maven with -f pom.xml2
option as reactor with projectB specified as module, it looks like that it picks pom.xml2
from the projectA, and it picks pom.xml
from projectB. Is there a way, how can I propagate the -f
option to the modules?
Thanks for answering.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因为我们可以在模块定义中指定pom文件。1
这是在模块中使用替代 pom 文件的示例。
Because we can specified pom file in module definition.1
Here's an example for using alternative pom file in module.
正如 Jörn Horstmann 评论的那样,我会尝试很多方法来在一个 pom 中使用配置文件。
如果这不可能,我能想到的唯一方法是通过使用带有配置文件的“switching pom”来绕过正常的 Maven 机制。这个pom作为pom.xml放在每个模块中,并为每个pom.xml2(或其他)都有一个配置文件,并在该配置文件中通过antrun-plugin执行另一个maven构建fe,并为您需要的pom使用-f:
As Jörn Horstmann comments I would try lots of things to get this working with profiles in one pom.
If that's not possible the only way I can think of to get this working is to bypass the normal maven mechanism by using a "switching pom" with profiles. This pom is put as pom.xml in each module and has a profile for each of your pom.xml2 (or others) and in that profile executes another maven build f.e. via the antrun-plugin with the -f for the pom you need: