read property file from a dependent project with maven

爱⌒轻易说出口 提交于 2019-12-12 04:26:25

问题


I have an issue when reading properties from a dependent project.

I have a core project, and my application has a dependency on it.

under classpath of core, it has file core.properties.

and my application need to read this property file, but it couldn't. It requires the core.properties in my classpath of my application, instead of core.

Is there an solution for that? One solution in my mind is that when I build my application.war, can I explictly declare that I want the core dependency be exploded?

Thanks for help!


回答1:


What do you mean by "read this property file"?

Since it will be on the classpath it should be accessible with getClass().getResourceAsStream().

If you really need it as a file, you can use the Dependency plugin's unpack-dependencies goal to unpack particular files as part of the build process.



来源:https://stackoverflow.com/questions/2468756/read-property-file-from-a-dependent-project-with-maven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!