• <bdo id='Dsd3i'></bdo><ul id='Dsd3i'></ul>
      1. <tfoot id='Dsd3i'></tfoot>

        <small id='Dsd3i'></small><noframes id='Dsd3i'>

        <legend id='Dsd3i'><style id='Dsd3i'><dir id='Dsd3i'><q id='Dsd3i'></q></dir></style></legend>
        <i id='Dsd3i'><tr id='Dsd3i'><dt id='Dsd3i'><q id='Dsd3i'><span id='Dsd3i'><b id='Dsd3i'><form id='Dsd3i'><ins id='Dsd3i'></ins><ul id='Dsd3i'></ul><sub id='Dsd3i'></sub></form><legend id='Dsd3i'></legend><bdo id='Dsd3i'><pre id='Dsd3i'><center id='Dsd3i'></center></pre></bdo></b><th id='Dsd3i'></th></span></q></dt></tr></i><div id='Dsd3i'><tfoot id='Dsd3i'></tfoot><dl id='Dsd3i'><fieldset id='Dsd3i'></fieldset></dl></div>
      2. Gradle:子模块中抛出的类错误没有这样的属性?

        时间:2023-07-14
        1. <tfoot id='cx23g'></tfoot>

          <small id='cx23g'></small><noframes id='cx23g'>

        2. <i id='cx23g'><tr id='cx23g'><dt id='cx23g'><q id='cx23g'><span id='cx23g'><b id='cx23g'><form id='cx23g'><ins id='cx23g'></ins><ul id='cx23g'></ul><sub id='cx23g'></sub></form><legend id='cx23g'></legend><bdo id='cx23g'><pre id='cx23g'><center id='cx23g'></center></pre></bdo></b><th id='cx23g'></th></span></q></dt></tr></i><div id='cx23g'><tfoot id='cx23g'></tfoot><dl id='cx23g'><fieldset id='cx23g'></fieldset></dl></div>

              <tbody id='cx23g'></tbody>

                <legend id='cx23g'><style id='cx23g'><dir id='cx23g'><q id='cx23g'></q></dir></style></legend>

                  <bdo id='cx23g'></bdo><ul id='cx23g'></ul>
                • 本文介绍了Gradle:子模块中抛出的类错误没有这样的属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用 dependencies-i-declare-common-dependencies-in-a-single-place">这个答案.

                  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:

                  No such property: libraries for class
                  

                  我该如何解决这个问题?

                  How can I fix this?

                  在顶级 build.gradle 中声明为属性的依赖项如下:

                  Dependencies declared as properties at top level build.gradle as follows:

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

                  尝试在 模块级别 build.gradle 中检索依赖项(抛出错误):

                  Trying to retrieve dependency in module level build.gradle (where error is being thrown):

                  testCompile([
                                libraries.junit
                  ])
                  

                  抛出错误:

                  No such property: libraries for class: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
                  

                  推荐答案

                  1. 在您的顶级 settings.gradle 中,包含您的子项目:

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

                  include 'subproject'
                  

                • 在您的顶级 build.gradle 中定义您的 ext 属性:

                • In your top level build.gradle define your ext properties:

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

                • 它不必是地图,如果您只使用 1 个值,但我坚持使用您的格式.

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

                  1. 要在你的 子项目 build.gradle 中使用它:

                  dependencies{
                    testCompile libraries.junit 
                  }
                  

                  这篇关于Gradle:子模块中抛出的类错误没有这样的属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:根据一个源文件的依赖关系创建 Java Eclipse 项目的子集 下一篇:在jar依赖中读取资源文件

                  相关文章

                    <i id='tPMcd'><tr id='tPMcd'><dt id='tPMcd'><q id='tPMcd'><span id='tPMcd'><b id='tPMcd'><form id='tPMcd'><ins id='tPMcd'></ins><ul id='tPMcd'></ul><sub id='tPMcd'></sub></form><legend id='tPMcd'></legend><bdo id='tPMcd'><pre id='tPMcd'><center id='tPMcd'></center></pre></bdo></b><th id='tPMcd'></th></span></q></dt></tr></i><div id='tPMcd'><tfoot id='tPMcd'></tfoot><dl id='tPMcd'><fieldset id='tPMcd'></fieldset></dl></div>
                  1. <tfoot id='tPMcd'></tfoot>
                    • <bdo id='tPMcd'></bdo><ul id='tPMcd'></ul>

                    <small id='tPMcd'></small><noframes id='tPMcd'>

                    <legend id='tPMcd'><style id='tPMcd'><dir id='tPMcd'><q id='tPMcd'></q></dir></style></legend>