0

I have a maven project that has 20+ modules and I need to use these modules as dependencies to another project.

Is there a way to add the whole project as a dependency?

I already know that I can add each module as a dependency but I want to keep the poms as clean as possible so please do not suggest adding each module as a dependency.

  • 1
    create a separate module (call xyz-bom) and create BOM which other project can use in their dependencyManagement... – khmarbaise Apr 10 '17 at 19:35
  • What's the problem with [creating a parent pom and use it](http://stackoverflow.com/questions/19395973/maven-adding-a-reference-to-a-parent-pom-project)? – Ivan Pronin Apr 10 '17 at 19:45
  • @IvanPronin if you read it until the end you'll figure out that this is not a solution to my problem. I know that I can add the dependencies to my new project but what I really want is to add only the old parent project and get all the **modules** as dependencies – Efstathios Oikonomou Apr 10 '17 at 19:53
  • @khmarbaise : bom and dependencyManagement are for managing versions, not for "add the whole project (and his 20+ modules) as a dependency" – Tristan Nov 03 '22 at 08:34

1 Answers1

0

You cannot add the whole project as dependency. You need not add each module as dependency.

The modules have dependencies on each other. You only need to add the modules you need in your code directly. The transitive dependencies are added automatically.

If you need a related set of dependencies you can also define a module with packaging pom in your multi-module project which gathers the relevant pieces as dependencies.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142