2

In Maven, is it possible to load resources in a child module from the parent project?

parent project
   ---child module 1
   ---child module 2

I have resources in the parent project src/main/resources which I would like to be made available for the child projects. Ideally the child projects could override any of the resources.

4

1 回答 1

2

利用库中的资源和/或覆盖库中的资源的最佳方法是将这些资源放在类路径中。例如,所有常见配置都存储common-config.properties并放置在src/main/resources父项目中。如果继承项目需要覆盖配置,继承项目可以简单地将覆盖的文件放在其src/main/resources. 在运行时,代码应该在类路径中查找这个属性,并且正确的文件将被加载。

于 2015-11-17T07:17:45.670 回答