Clean/Install Multiple maven projects in order without reactor

只谈情不闲聊 提交于 2021-01-27 19:30:01

问题


Project Structure:

Parent-Prj (pom.xml)

  • P1
  • P2 (Dependent on P1)

Details:

  • P1/P2 specified as modules in parent project pom (Parent-Prj)
  • P2 is dependent on P1 (with this depencency specified in pom of P2)

We are using a custom maven plugin (eclipse plugin with buttons provided for clean/install/compile etc). Issues due to that:

  1. P1/P2 specified as modules in parent project pom. However the projects are not being executed in order. i'e P1 should be build before P1 due to dependency specified. Suspect the reactor is not working
  2. There is no command line interface.

Problem:

I want to clean / install these project in order from parent pom.

The order should be:

  • P1 (Clean and install)
  • P2 (Clean and install)

Is there a way I can do that without reactor plugin as it does not seem to work in this custom plugin ?

Update: Taking look at assembly plugin


回答1:


just make sure you have this code in you parent pom file

<modules>
  <module>p1</module>
  <module>p2</module>
</modules>

the above is order of which the projects will be build.

in above configuration p1 will be compiled first and later p2 will.

EDIT - since p2 depends on P1, P1 needs to be compiled first.

to achieve this you need to clean install of the parent pom.

  1. which cleans module 1 and build.
  2. second module 2 cleaned and build.

and also see this maven example link , for building multiple module projects.

http://books.sonatype.com/mvnex-book/reference/multimodule-sect-building-multimodule.html



来源:https://stackoverflow.com/questions/19650743/clean-install-multiple-maven-projects-in-order-without-reactor

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