简体   繁体   English

将 gradle 项目导入 eclipse 时出错

[英]error importing gradle project into eclipse

It´s my first time with gradle , I´m trying to import a gradle project into my Eclipse .这是我第一次使用 gradle ,我正在尝试将 gradle 项目导入到我的 Eclipse 中。

Eclipse Java EE IDE for Web Developers.面向 Web 开发人员的 Eclipse Java EE IDE。 Version: Photon Release (4.8.0) Build id: 20180619-1200 OS: Windows 10, v.10.0, x86_64 / win32 Java version: 1.8.0_181版本:Photon Release (4.8.0) 版本号:20180619-1200 操作系统:Windows 10, v.10.0, x86_64 / win32 Java 版本:1.8.0_181

using import "Existing Gradle Project" ..I´m getting a error on the使用导入“现有 Gradle 项目”..我在

org.gradle.tooling.BuildException: Could not fetch model of type 'GradleBuild' using Gradle distribution ' https://services.gradle.org/distributions/gradle-4.3-bin.zip '. org.gradle.tooling.BuildException:无法使用 Gradle 发行版“ https://services.gradle.org/distributions/gradle-4.3-bin.zip ”获取“GradleBuild”类型的模型。

...... Caused by: org.gradle.internal.exceptions.LocationAwareException: Build file 'C:\\WorkArea\\os_temp\\build.gradle' line: 14 ...... 引起:org.gradle.internal.exceptions.LocationAwareException: Build file 'C:\\WorkArea\\os_temp\\build.gradle' line: 14

line: 14 --> props.load(new FileInputStream("build.properties")) ....行:14 --> props.load(new FileInputStream("build.properties")) ....

Caused by: java.io.FileNotFoundException: build.properties (The system cannot find the file specified)引起:java.io.FileNotFoundException:build.properties(系统找不到指定的文件)

the build.properties is there in the root folder of the project that I´m trying to import build.properties 位于我尝试导入的项目的根文件夹中

this is the project that i´m trying to import https://github.com/krishagni/openspecimen这是我试图导入的项目https://github.com/krishagni/openspecimen

thank you Roque谢谢罗克

I got the same issues for gradle-5.3.1 , but while importing the project:我在gradle-5.3.1遇到了同样的问题,但是在导入项目时:

  • I've changed "Local Installation Directory" to C:\\gradle-5.3.1我已将“本地安装目录”更改为C:\\gradle-5.3.1
  • and "Gradle User Home" to the C:\\gradle-5.3.1\\bin and after this the project imported successfully, it solved my problem.和“Gradle User Home”到C:\\gradle-5.3.1\\bin并且在此之后项目成功导入,它解决了我的问题。

I hope this helps in your case.我希望这对您的情况有所帮助。

在图片中查看我的配置

Try with this option during import在导入期间尝试使用此选项在此处输入图片说明

  1. Comment or temporarily remove the content in build.gradle file/files.注释或临时删除 build.gradle 文件/文件中的内容。
  2. Delete .project and .classpath files in the folder you're importing (if any exists).删除正在导入的文件夹中的 .project 和 .classpath 文件(如果存在)。
  3. Override workspace settings and set it to Gradle wrapper覆盖工作区设置并将其设置为 Gradle 包装器
  4. Specify Gradle user home (bin folder of gradle) and Java home jdk folder and click Next.指定 Gradle 用户 home(gradle 的 bin 文件夹)和 Java home jdk 文件夹,然后单击 Next。
  5. This solved my problem.这解决了我的问题。 If it doesn't work for you then try different options like setting Local installation directory for gradle and so on.如果它不适合您,请尝试不同的选项,例如为 gradle 设置Local installation directory等。
  6. Once this works, you can put the content back to your build.gradle files and try again so that you know which line in build.gradle file causes the issue.一旦成功,您可以将内容放回 build.gradle 文件并重试,以便您知道 build.gradle 文件中的哪一行导致了问题。

Note : The import might fail for other reasons as well which might need a different troubleshooting.注意:导入也可能因其他原因而失败,这可能需要不同的故障排除。 This worked for me though.不过这对我有用。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM