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

  • <small id='wAAyJ'></small><noframes id='wAAyJ'>

  • <legend id='wAAyJ'><style id='wAAyJ'><dir id='wAAyJ'><q id='wAAyJ'></q></dir></style></legend>

        如何在 Java 模块中指定源和目标兼容性?

        时间:2023-09-28
            <legend id='NJgzn'><style id='NJgzn'><dir id='NJgzn'><q id='NJgzn'></q></dir></style></legend>

            <tfoot id='NJgzn'></tfoot>

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

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

              • <bdo id='NJgzn'></bdo><ul id='NJgzn'></ul>

                  本文介绍了如何在 Java 模块中指定源和目标兼容性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个 Gradle 项目,其中包含一个 Android 模块(com.android.library 插件应用在 build.gradle 文件中)和一个 Java 模块(java 插件应用在 build.gradle 文件中).在 Java 模块的 build.gradle 文件中,我之前指定了源和目标的兼容性,如下所示:

                  I have a Gradle project consisting of an Android module (the com.android.library plugin is applied in the build.gradle file) and a Java module (the java plugin is applied in the build.gradle file). Within the build.gradle file of the Java module I was previously specifying the source and target compatibility as follows:

                  apply plugin: 'java'
                  
                  compileJava {
                      sourceCompatibility = 1.7
                      targetCompatibility = 1.7
                  }
                  

                  我刚刚将项目的Android Plugin for Gradle"和Gradle Wrapper"版本更新为最新版本(分别为 2.2.3 和 3.2.1),现在我在 Java 模块中看到如下警告:

                  I've just updated the project's "Android Plugin for Gradle" and "Gradle Wrapper" versions to the latest releases (2.2.3 and 3.2.1 respectively) and I'm now seeing warnings in the Java module as follows:

                  Access to 'sourceCompatibility' exceeds its access rights
                  Access to 'targetCompatibility' exceeds its access rights
                  

                  如果我将 sourceCompatibilitytargetCompatibility 声明移动到模块的 build.gradle 文件的根级别,如下所示...

                  If I move the sourceCompatibility and targetCompatibility declarations to the root-level of the module's build.gradle file as follows...

                  apply plugin: 'java'
                  
                  sourceCompatibility = 1.7
                  targetCompatibility = 1.7
                  

                  ...然后我收到警告消息,告诉我分配未使用.

                  ... then I get warning messages telling me that the assignments are not used.

                  在最新的 Gradle 版本中指定 Java 模块的源和目标兼容级别的正确方式是什么?

                  What is the correct manner of specifying the source and target compatibility level of a Java module in the latest Gradle release?

                  推荐答案

                  我认为最后一个(根中的声明)是正确的,它必须正常工作,尽管它会在 IDE 中引起警告.无处可说,声明它的首选方式是什么,official docs,它被用作:

                  I think that the last one(declaration in the root) is the correct one and it has to work properly, though it causes warnings in IDE. It's nowhere said, what is the prefered way to declare it and there is only one example in the official docs, where it's used as:

                  sourceCompatibility = 1.6
                  

                  build.gradle 的根目录中.

                  这篇关于如何在 Java 模块中指定源和目标兼容性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:java.exe 在使用 Facebook SDK 时以非零退出值 2 结束 下一篇:没有可用于离线模式的 com.android.tools.build:aapt2:

                  相关文章

                  最新文章

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

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

                      <tfoot id='TnzQc'></tfoot>
                        <bdo id='TnzQc'></bdo><ul id='TnzQc'></ul>