Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven how to include /src/main/resources

I have a mavenized project with jar packaging, have standard layout:

/src/main/java
/src/main/resources

When I execute: mvn package

I am expecting the resulting jar (non-executing) file to include the resources folder and everything inside that folder from the project(i.e. some xml files), but when I open the jar file I only see the com folder where and the contents of the resources folder in the top level...

I think the above is default for maven3, but I want to include the resources folder in the jar file...

like image 512
user1800734 Avatar asked Nov 20 '12 21:11

user1800734


1 Answers

You will not see src/main/resources in resulted jar file.

You will only see the contents of src/main/resources in the jar file.

So, if you did not create a package structure for your resource files and dumped everything into src/main/resources directory, you will see your resource files at the top level of your jar.

If you want your resources appear under certain directory in the resulting jar file, create such a directory under src/main/resources tree.

like image 78
Alexander Pogrebnyak Avatar answered Sep 20 '22 02:09

Alexander Pogrebnyak