[SOLVED] Inheritance of dependency packages between sub-modules in maven

Problem phenomenon:

I encountered a problem in the project today:

When dependencies are configured in the submodule's pom.xml, another submodule cannot automatically import these dependencies?


problem analysis:

The pom.xml of the submodule: 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 materials, it can be seen that: it turns out that the dependency package of the unit test is independent, and its related dependency package cannot be inherited and imported by other modules;

Therefore, if you want a one-time configuration, you can configure it in the pom.xml of the parent module, so that all sub-modules can inherit and import dependent packages.


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/109247760