Gradle: No such property for class error thrown in sub-module?

前端 未结 1 1316
迷失自我
迷失自我 2021-01-19 05:44

I am trying to declare the dependencies in my gradle project using the technique described in this answer.

However when I do so I get this error:

1条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-19 06:20

    1. In your top level settings.gradle, include your subproject:

      include 'subproject'
      
    2. In your top level build.gradle define your ext properties:

      ext.libraries = [junit: 'junit:junit:4.10']
      

    it does not have to be a map, if you're using just 1 value, but I'm sticking with your formatting.

    1. To use this in your subproject build.gradle:

      dependencies{
        testCompile libraries.junit 
      }
      

    0 讨论(0)
提交回复
热议问题