Does it make sense to create many parent Maven priests based on project types?

I'm trying to figure out what would be the best way to organize Maven projects. Say I have these projects -

  • ProjectA - webapp, uses Spring MVC
  • ProjectB - usage library1, uses logging, snakeyml
  • ProjectC - library2 utility, uses logging, snakeyml
  • ProjectD - DAO library, uses logging, uses Spring annotations

A depends on D, D depends on C. B does not depend on anything.

I created a parent-pom project with snakeyml, slf4j and log4j parameters as dependencies. I declared this project a parent in B, C, and D poms. Parent pom also defines compiler-specific properties.

I understand that when you declare something as a parent, Maven inheritance in poms allows child projects to inherit all dependencies. If this is correct, should I have several parental priests? Say the same as parent-pom, should there be a parent spring-pom from which all Spring projects will inherit? Is it good practice to have so many different parents, just to have a better organization of dependencies, but not a logical hierarchy of projects? In addition, I do not declare that the child projects are modules in the parent because some of them are independent libraries. Am I diverging too much from the Maven conventions?

+4
source share
1 answer

, .

, parent-spring-pom, Spring. , Spring JSF? ? , , ? , . , -, , , .

Maven .

, . , . , , -, , ...

, , (, - ). project-dao project-dao-wsclient ( -) project-dao-db ( ).

+3

Source: https://habr.com/ru/post/1617118/


All Articles