Gradle: common resource dependency for multiple java projects

后端 未结 6 536
鱼传尺愫
鱼传尺愫 2020-12-28 17:47

I\'m developing a multi-module project with gradle/intellij-idea, and here is the structure of my project home:

project/
  sub-project-1
    /main/resources
         


        
6条回答
  •  太阳男子
    2020-12-28 18:26

    You need to choose the project which will hold your resources. All the other projects that require those resources, will add them to the resources component of the sourceSets.

    sourceSets {
        data {
            resources {
                srcDir "${project(':data').projectDir}/src/main/resources"
                include "your_pattern_here**"
            }
        }
        main {
            resources {
                srcDirs += [ data.resources ]
            }
        }
    }
    

提交回复
热议问题