Custom pom.xml filename in Maven multimodule for Tycho

谁都会走 提交于 2019-11-29 14:21:51

You can include projects in an aggregator POM by specifying the full name to the POM file with custom name. Example:

<modules>
    <module>org.example.bundle1</module>
    <module>org.example.bundle2</module>
    <module>org.example.keybundle/pom-tycho.xml</module>
</modules>

This both works in a pure Maven and Maven/Tycho build.

To extend @oberlies answer a little bit:

SCENARIO: top aggregation POM comes in multiple flavors, so any style can be built from the top.

<!-- in file pom.xml -->
<modules>
  <module>org.example.bundle1</module>
  <module>org.example.bundle2</module>
  <module>org.example.keybundle</module>
</modules>

All submodules will be built using their standard pom.xml

and

<!-- in file pom-tycho.xml -->
<modules>
  <module>org.example.bundle1/pom.xml</module>
  <module>org.example.bundle2/pom.xml</module>
  <module>org.example.keybundle/pom-tycho.xml</module>
</modules>

Submodules will be built using the specifically named POM file.

and, likewise:

<!-- in file pom-special.xml -->
<modules>
  <module>org.example.bundle1/pom.xml</module>
  <module>org.example.bundle2/pom-special.xml</module>
  <module>org.example.keybundle/pom-tycho.xml</module>
</modules>

Submodules that have custom POM files use them, and others state they still want the normal POM file, all independent of the name of the top aggregation POM file.

Because mvn -f pom-tycho.xml assumes that file name in all submodules. So if you do want pom.xml in any submodule when the top file isn't named pom.xml you need to fully specify for each submodule.

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