开发者

Where in Maven should reusable domain and persistence classes go?

I have a开发者_开发问答 Maven project that I want to break out into pieces such that my domain and persistence objects can be reused by other maven projects. What would be considered the best approach?

  • Move the domain and persistent objects into a separate project and have it be the parent POM of any other projects that need it

  • Put it in a separate project, but make it a jar to be used as a dependency via POM.xml in other projets

  • Other?


I wouldn't make it a parent project. Sounds like you need two separate projects; one for domain and one for persist.

If the other modules that need to reference your domain are part of the same releasable unit (they follow the same release cycle) then you can make them modules in a multi-module project. If they have different release cycles then you should treat them as separate projects and define the dependency via the normal Maven dependency mechanism.


If it can be broken down into a separate reusable module do so. I usually have a "-domain" project that deals only with domain objects. In the old days I also put in my Hibernate xml files in there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜