This is what I have found and it worked for me. The help provided by @BalusC worked for me. I have collated what I have found and how I have verified that it is working.
I have got a maven project with following structure as shown below

Now when I build this project; the jar looks like

and here queries.properties moves under "META-INF" folder. Now if this jar has a class which is trying to utilize this property file using
Thread.currentThread().getContextClassLoader().getResourceAsStream("queries.properties")
thinking that the same file can still be accessed under resources folder as shown in project structure, that is wrong. The correct way is to access via META-INF folder
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream is = classLoader.getResourceAsStream("META-INF/queries.properties");
How did I verified
Just create a simple java project and include the jar you have just created into its build path and create an instance of class which is having ClassLoader statements as mentioned above. Your code in this new java project should look like
public static void main(String[] args){
new Queries();
}
where Queries
is a class in jar you have just included in your build path.