views:

77

answers:

1

Hi, 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  A: 

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.

Brett Porter
I mean that the property file I want to read is in a jar file, and it's used as a dependency in another module. And when I try to read the properties in my module, it couldn't find it because that properties file is in the depenedency jar file. not on the classpath of my module.Am I explaining clearly? Sorry for my bad english :) and does anyone has a good solution?I will have a look into unpack dependencies also.