In a Maven multi-module project, how to specify dependency needed in more than one module?

Viewed 1473

I know that the intent of a multi-module Maven project is that each module can be compiled and built separately as well as collectively from the parent.

Suppose two of my three modules need to use the Google Guava library. Do I specify that dependency in the POM of each of the two sub-modules? If so, what “scope”? Or do I specify the dependency in the parent module? I need Guava bundled in my final product, but I certainly don't need two copies.

2 Answers
Related