Relative project dependencies in Gradle?

后端 未结 5 1152
眼角桃花
眼角桃花 2021-01-30 17:30

When specifying Gradle project dependencies, can I avoid using a full absolute project name and use a relative one instead? (i.e. in my example I don\'t want to explicitly speci

5条回答
  •  自闭症患者
    2021-01-30 17:50

    A late answer never hurts. My solution was close to what @lihsus suggested.

    Say you have the following project structure:

    //Directory structure
    app-a/
       domain-a/
           build.gradle
       webapp-a/
           build.gradle
    

    Make sure your app-a has a build.gradle and a settings.gradle.

    In the settings.gradle of app-a you can then include both modules/projects such as:

    include ':domain-a'
    include ':webapp-a'
    

    And then in webapp-a you can add domain-a as a compile dependency such as you suggested:

    compile project(':domain-a')
    

提交回复
热议问题