0

I'm using gradle to manage a multi-modules spring boot project.

->Root

---> module-1
--------->src/main/java
--------->src/test/java/application.properties

---> module-2
--------->src/main/java
--------->src/test/java/application.properties

---> SHARED-FOLDER
---------> data.json

In my test application.properties of module-1 I want to reference SHARED-FOLDER/data.json file, something like :

application.properties

my.json.data.file=SHARED-FOLDER/data.json

But it's not working. I've tried :

my.json.data.file=${user.dir}/SHARED-FOLDER/data.json

but user.dir references module-1not root

How can I reference root/SHARED-FOLDER/data.json in an application.properties inside another module?

flywell
  • 384
  • 3
  • 20

1 Answers1

0

I've managed to add the shared folder to my classpath and then reference it like :

my.json.data.file=classpath:data.json

In my gradle sub-modules I've added :

subprojects {
    apply plugin: 'java'

    sourceSets {
        main {
            resources {
                srcDirs += [
                        "$rootDir/SHARED-FOLDER"
                ]
            }
        }
    }
}
flywell
  • 384
  • 3
  • 20