Sakshi Arora
Sakshi Arora

Reputation: 83

maven - building a project without explicitly building another (dependent) project

I have two separate maven projects A and B residing in my local repository. A project depends on the jar of B. If I need to build project A successfully, what I do is :

Import both A and B as maven project in Eclipse

Question : Is it possible that instead of explicitly import and building project B, I can only import and build project A. Something which can automatically import and build dependent projects)

Upvotes: 1

Views: 65

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35853

Two main possibilities:

  • If you are mainly interested in testing, you can checkout both projects into your Eclipse workspace and use "Workspace Resolution", which is a feature of the m2e (Maven) plugin and can be enabled through a right click on the project. It does not make a complete build, but changes in project B will immediately be used by project A as long as you start/handle the project inside Eclipse.

  • If you really need a complete build, think about putting both projects as modules into one multi module project. Then you can build both together and Maven determines the build order. The downside: The projects are now tied together and cannot (at least: should not) be build separately any more.

Upvotes: 1

Related Questions