开发者

placing XML files in non-resources of jar with Maven

开发者 https://www.devze.com 2023-02-19 19:55 出处:网络
Thi开发者_开发知识库s is more of a pattern question. I am using maven to create a three module project.

Thi开发者_开发知识库s is more of a pattern question. I am using maven to create a three module project.

Domain, Services, Site

The services module depends on the domain module. Now in the services module I am using an ORM (MyIbatis) and I need to have lots of XML files in my services module. I could place the XML files in the package that contains the .java files, or I can place the XML files under the resources directory.

My question is, what is the best pattern for when you have resources that are mapped to a single .java in the same module. Would you place that resource in the package that contains the .java or in the "resources" directory that maven uses? What are the pros and cons?

I know at the end of the day the resources and java directories get merged into the artifact (.jar), but on principal I would like to know what others do.

Update -- The reason I would like to place the XMLs in the java src directory is because I dont want to recreate the package structure under the resources directory -- to help with the maintainability of package structure changes, etc.


I would put them alongside my Java files personally. You're going to be bouncing back and forth between the object and the XML a lot, in all likelihood. It's annoying to be constantly switching between the two folders.

I put the stuff I don't go to as much while coding, such as property files or log4j.xml, in the resources folder.

But that's just me.

0

精彩评论

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