How to create common resources folder for multiple modules?

Viewed 1525

I want to create project which have multiple modules.my project project will look like this:

> main-module
  >> module1(Project1)
     >>> module1 pom.xml
  >> module2(Project2)
     >>> module2 pom.xml
  >> resources
  >> main-module pom.xml

I have resources folder that belongs to module1.I want to put this resources into main-module such that this resources file is now accessable by both module1 and module2.

1 Answers

You already got working solution provided in comments.

But depending on the type of resources you want to maintain and share with other projects you could also consider making own project for the resources.

Install it then with maven and add as dependency for other projects needing it.

This solution of course might require changes in your code if you for example fetch stuff like property files or images from jar having resources.

Related