IntelliJ Gradle无法确定Java版本 [英] IntelliJ Gradle Could not Determine Java Version

查看:230
本文介绍了IntelliJ Gradle无法确定Java版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用IntelliJ处理Gradle项目.我注意到,每当我尝试刷新Gradle项目(或尝试将项目作为Gradle项目导入/重新导入)时,都会出现以下错误:

I'm using IntelliJ to work with a Gradle project. I noticed that whenever I try to refresh the Gradle project (or when trying to import/re-import a project as a Gradle project) I get the following error:

Error: Could not determine the Java version

$JAVA_HOME,将SDK设置为Java 8(并且gradle -version确认它也设置为Java 8),并且该项目可从命令行正常构建.重新启动IntelliJ也不执行任何操作.我还删除了项目专用文件夹和全局.gradle文件夹,这不能解决问题.

$JAVA_HOME is set, the SDK is set to Java 8 (and gradle -version confirms it is also is set to Java 8), and the project builds fine from the command line. Restarting IntelliJ also does nothing. I also deleted the project specific and global .gradle folders, which did not resolve the issue.

我正在Ubuntu 15.04和Gradle 2.5上运行IntelliJ 14.1.4.

I am running IntelliJ 14.1.4 on Ubuntu 15.04 and Gradle 2.5.

在运行IntelliJ 14.1.1的另一台计算机(也包括Ubuntu 15.04,Oracle Java 8)上对其进行了尝试,并且工作正常.

Tried it on a different machine (also Ubuntu 15.04, Oracle Java 8) running IntelliJ 14.1.1 and it worked correctly.

推荐答案

我也遇到了这个问题.似乎它与正在使用较旧的gradle构建进行设置的项目相关联.在/gradle//wrapper/gradle-wrapper.properties中将distributionUrl更改为新的发行版即可解决

I had this problem too. It seems it was linked to the project being setup with a rather old gradle build. Changing distributionUrl to a new distribution in /gradle//wrapper/gradle-wrapper.properties solved it

这篇关于IntelliJ Gradle无法确定Java版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆