4

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.

fatih yavuz
  • 89
  • 10
  • 1
    Maven resources plugin? https://maven.apache.org/plugins/maven-resources-plugin/examples/resource-directory.html – JJF Nov 09 '17 at 12:59
  • If the resources belong to module 1 than put it into module1. Furthermore the main module does not contain code nor resources etc. And what do you mean by accessible by modul1 and 2 ? – khmarbaise Nov 09 '17 at 13:17
  • module2 need to access module1 resources folder to not create another one from the same file.by the way modules mean diffrent projects in same directory as main-module – fatih yavuz Nov 09 '17 at 13:25
  • @jjf thank you for your reply.i created new resource in main-module and added resource with full path to pom.xml.than its worked thanks. – fatih yavuz Nov 09 '17 at 13:34

1 Answers1

1

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.

pirho
  • 11,565
  • 12
  • 43
  • 70