gpt4 book ai didi

java - 找不到符号intellij gradle

转载 作者:行者123 更新时间:2023-12-03 03:12:19 25 4
gpt4 key购买 nike

这个看似非常简单甚至愚蠢的问题一直困扰着我。

我做了什么:

  • 在全新的Mac OS X 10.13.6上
  • 我使用Intellij CE 2018.1版本从Github checkout 了一个仓库。
  • 每当我尝试从Intellij的此存储库中运行单元测试时,它只会说:“找不到符号”,下面的截图:
    enter image description here
  • 我没有在本地进行任何更改,这是我从git repo中 check out 的绿色构建项目。
  • 这是build.gradle文件
    apply plugin: 'java'
    apply plugin: 'checkstyle'

    group = 'com.fishercoder'
    version = '1.0-SNAPSHOT'

    checkstyle {
    //include ( '**/*.java')
    configFile = file("${rootDir}/fishercoder_checkstyle.xml")
    }

    description = """"""

    sourceCompatibility = 1.9
    targetCompatibility = 1.9

    repositories {
    mavenCentral()
    maven { url "http://repo.maven.apache.org/maven2" }
    }

    dependencies {
    compile 'com.google.code.gson:gson:2.8.0'
    testCompile group: 'junit', name: 'junit', version:'4.12'
    }

  • 我尝试过的
  • 有趣的是,我可以在 src 代码部分中打印出“Hello world”,但是 tst 部分只是不在Intellij中编译。
  • 我已使高速缓存无效,并重新启动了Intelij,没有运气。
  • 我已经删除了磁盘上的文件夹,完全关闭了Intellij,首先将git clone重做到磁盘中,然后打开Intellij导入它,如下所示:
    enter image description here

  • 然后将其导入为gradle项目,如下所示:
    enter image description here

    将所有内容保留在默认情况下:
    enter image description here

    然后在我的Intellij控制台中,出现此错误:
    enter image description here
    任何帮助表示赞赏!

    最佳答案

    看起来像在导入项目时,Gradle包装器正在为JDK 10选择一个不兼容的Gradle版本(See This)。

    您可以尝试在系统中手动安装gradle(最好是大于4.7的任何版本)。然后选择选项“使用本地gradle分发”并在Intellij中指定gradle安装路径。

    那你应该没事!

    关于java - 找不到符号intellij gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52195643/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com