Gradle: common resource dependency for multiple java projects

后端 未结 6 541
鱼传尺愫
鱼传尺愫 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:39

    One solution is to apply the Java plugin also to the data project, and then use regular project dependencies (e.g. dependencies { runtime project(":data") }). However, this would require a bit of effort to prevent shipping the test resources.

    Another solution is not to make data a Gradle project but literally include its resource directories in the other two projects (sourceSets.main.resources.srcDir "../data/main/resources"; sourceSets.test.resources.srcDir "../data/test/resources").

提交回复
热议问题