How to make maven build of child module with parent module?

后端 未结 2 597
我在风中等你
我在风中等你 2020-12-16 16:07

I have multiple modules in my project and they are dependent on each other either directly or transitively. When I maven build «Project A» some where «Project D» gets build

2条回答
  •  情书的邮戳
    2020-12-16 16:31

    For a parent project Maven will build all child modules while building parent project. Add the modules to your parent pom. Assuming A is your parent project

      
        projectB
        projectC
        projectD
      
    

    and in modules (B,C and D), add project A as parent (This is optional, Thanks @Guillaume Polet)

     
       foo.bar
       ProjectA
       1.0-SNAPSHOT
     
    

    So if you build projectA, it will build ProjectB, ProjectC and ProjectD. Also maven is smart enough to figure out correct build order for B,C and D.

提交回复
热议问题