Java 如何在 IntelliJ 中导入 Gradle 项目?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31256356/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 10:50:46  来源:igfitidea点击:

How to import Gradle Projects in IntelliJ?

javaintellij-ideagradle

提问by Nemos

I used libGDX for an longer time and now after an reinstallation I want to use it with Gradle.

我使用 libGDX 的时间更长,现在重新安装后我想将它与 Gradle 一起使用。

I downloaded the setup.jar and created an project with it like described here. I imported that into IntelliJ and setted for the core Package the dependency to graddle_wrapper and for the 2nd Package "desktop" to core. I run build.gradle, without problems.

我下载的setup.jar与它像描述创建的项目在这里。我将它导入到 IntelliJ 中,并为核心包设置了对 graddle_wrapper 的依赖,并将第二个包“桌面”设置为核心。我运行 build.gradle,没有问题。

But still, IntelliJ is not able to recognise the libGDX Packages - they are red.

但是,IntelliJ 仍然无法识别 libGDX 包 - 它们是红色的。

What do I have todo else in order to get libGDX running? (Or any other Project with Gradle)

为了让 libGDX 运行,我还需要做什么?(或任何其他带有 Gradle 的项目)

采纳答案by dimoniy

Do an Import Projector Open...and navigate to build.gradlefile. This should be enough for IntelliJ to figure out the dependencies and set up the project.

执行Import ProjectOpen...导航到build.gradle文件。这应该足以让 IntelliJ 找出依赖项并设置项目。