Relative project dependencies in Gradle?

后端 未结 5 1101
眼角桃花
眼角桃花 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条回答
  •  -上瘾入骨i
    2021-01-30 18:03

    Although using relative paths might be a bad practice, sometimes you might just need it that way. Nevertheless, here is how you can get it to work.

    You need to create settings.gradle file inside webapp-a

    webapp-a/settings.gradle

    include '..:domain-a'
    

    Then in webapp-a/build.gradle

    compile project(':..:domain-a')
    

    (haven't tested it myself but it should work)

    EDIT: replaced ../domain-a by ..:domain-a in both files

提交回复
热议问题