[SOLVED] Maven's parent-child dependency package inheritance problem

Problem phenomenon:

I encountered a problem in the project today:

After the dependencies are configured in the pom.xml of the parent module, the child modules cannot automatically import these dependencies?


problem analysis:

The pom.xml of the parent module: Here we mainly look at these two dependency packages for test unit testing!

Submodule: Since these dependency packages are not imported, the program reports red.

By consulting online information, we can know:

Original is because, in the parent module I <dependencyManagement> </ dependencyManagement> tag inside the <dependencies> </ dependencies> tag, the introduction of these two dependencies, and the inside of the label is not directly dependent on the package module quilt Recognizable

If you want to be automatically recognized, you need to create another <dependencies></dependencies> tag outside of the <dependencyManagement></dependencyManagement> tag, and then introduce the dependency package.


Solution:

Pom.xml of the parent module: modified to:

Submodules can detect dependent packages and automatically import them:

Guess you like

Origin blog.csdn.net/weixin_42585386/article/details/109247623
Recommended