本文介绍了Gradle-无法使用工具链:"JDK 7(1.7)"来定位平台:"Java SE 8"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Intellij Idea中使用本地Gradle distrib导入Gradle项目,并使用以下消息获取stacktrace:Could not target platform: 'Java SE 8' using tool chain: 'JDK 7 (1.7)'.谁能解释一下可能是什么原因?

I am trying to import Gradle project in Intellij Idea with local Gradle distrib and getting stacktrace with the following message: Could not target platform: 'Java SE 8' using tool chain: 'JDK 7 (1.7)'.Could anyone explain please what could be the reason?

推荐答案

最后,我导入了Gradle项目.这些是步骤:

Finally I imported my Gradle project. These are the steps:

  1. 我从本地Gradle分发服务器切换到了Intellij Idea Gradle Wrapper(等级2.14).
  2. 我将系统变量JAVA_HOME指向 JDK 8 (之前是第7位)通过实验发现Gradle Wrapper可以处理仅使用 JDK 8 的项目.
  3. 我删除了以前手动创建的文件 gradle.properties (Windows用户.gradle目录中的org.gradle.java.home variable)因为我猜想,它并没有给Gradle带来任何额外的价值.
  1. I switched from local Gradle distrib to Intellij Idea Gradle Wrapper(gradle-2.14).
  2. I pointed system variable JAVA_HOME to JDK 8 (it was 7th previously) as I hadfigured out by experiments that Gradle Wrapper could process theproject with JDK 8 only.
  3. I deleted previously manually created file gradle.properties (withorg.gradle.java.homevariable) in windows user .gradle directoryas, I guessed, it didn't bring any additional value to Gradle.

这篇关于Gradle-无法使用工具链:"JDK 7(1.7)"来定位平台:"Java SE 8"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 01:16