如何在IntelliJ 15中导入现有的Grails 3(3.0.12)项目 [英] How do I import an existing Grails 3 (3.0.12) project in IntelliJ 15

查看:186
本文介绍了如何在IntelliJ 15中导入现有的Grails 3(3.0.12)项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IntelliJ的网站上有关于创建新Grails项目的文档,但导入项目更加粗略,我无法让它为我工作。

There's documentation on IntelliJ's website for creating a new Grails project, but importing a project is more sketchy and I cannot get it to work for me.

如果我告诉IntelliJ导入一个新项目,并将其指向我的项目目录,它不会将其识别为Grails项目。项目导入后,我可以转到项目菜单,右键单击项目并转到添加框架支持...并选择Groovy,但IntelliJ仍然无法将我的项目识别为Grails项目。例如,使用新的Grails项目,运行菜单将包含一个用于运行应用程序的按钮,该按钮将使用与Grails同义的3杯图标进行装饰。我的导入项目无法实现。

If I tell IntelliJ to import a new project, and point it to my project directory, it does not recognize it as a Grails project. After the project imports, I can go to the Project menu, right click on the project and go to "add Framework support..." and select Groovy, but IntelliJ still does not recognize my project as a Grails project. For instance, with a new Grails project the run menu would contain a button for running the app that would be decorated with the 3-cups icon synonymous with Grails. I don't get that with my imported project.

以下是我到目前为止所采取的具体步骤:

Here are the precise steps I'm taking so far:


  1. 从我刚刚完成的新项目开始。这是一个项目,我可以使用grails compile手动构建。

  2. 打开IntellliJ 15 UE并选择导入项目

  3. 选择包含我的build.gradle文件和grails-app目录的顶级目录

  4. 选择从现有来源创建项目

  5. 默认项目名称/位置

  6. 选择找到的所有源目录。其中包括:

  1. Start with my fresh unimported project. This is a project and I can build manually using grails compile.
  2. Open IntellliJ 15 UE and select "Import Project"
  3. Select the top level directory containing my build.gradle file and grails-app directory
  4. Select Create project from existing sources
  5. Default project name/location
  6. Select all source directories that were found. These include:

  1. grails-app conf,controllers,domain,init,taglib目录

  2. src / main / groovy

  3. test / unit

  1. grails-app conf, controllers, domain, init, taglib directories
  2. src/main/groovy
  3. test/unit


  • 图书馆屏幕,使用默认的gradle-wrapper选项

  • 模块屏幕中,使用3

  • 选择项目SDK ...我选择了我的1.8 JDK设置。这里没有提到Grails。

  • 我看到No Frameworks detected消息。我可以在这里配置Grails吗?

  • 选择完成。

  • At the Libraries screen, go with the default gradle-wrapper option
  • At the Modules screen go with the 3
  • "Select project SDK..." I select my 1.8 JDK setup. There's no mention of Grails here.
  • I see a "No Frameworks detected" message. Should I be able to configure Grails here?
  • Select finish.
  • 此时我我在IntelliJ编辑器窗口中有一个没有构建的项目。我可以转到添加框架支持并启用对Groovy的支持,然后引用我的Grails SDK。但无论如何我觉得我不应该这样做。我认为IntelliJ应该能够检测我的Project类型和特性,而我只是没有正确配置它。

    At this point I'm at the IntelliJ editor window with a project that doesn't build. I can go to "Add Frameworks Support" and enable support for Groovy and at that point reference my Grails SDK. But in any case I feel like I shouldn't have to do this. I think IntelliJ ought to be able to detect my Project type and characteristics and that I'm just not configuring it right.

    但无论如何,我的项目仍然无法编译在IntelliJ里面。我必须通过控制台构建它。现在我的所有Java文件都没有位于src / main / groovy编译中。所有引用 org.springframework 的导入都会返回无法解析符号错误。

    But regardless, my project still doesn't compile inside IntelliJ. I have to build it via the console. Right now none of my Java files located in src/main/groovy compile. All of the imports that references org.springframework are coming back with the "cannot resolve symbol" error.

    推荐答案

    我之前也遇到过这个问题。唯一的方法是:

    I've had this issue before as well. The only way around it is to:


    • 吹掉intellij项目

    • 从现有资源导入

    • 双击build.gradle

    • 确保gradle上的自动导入设置为false

    • Blow away the intellij project
    • Import from Existing Sources
    • Double click the build.gradle
    • Ensure auto-import on gradle is set to false

    这是与IntelliJ相关的问题 - https:// youtrack。 jetbrains.com/issue/IDEA-149513

    Here's the IntelliJ issue related - https://youtrack.jetbrains.com/issue/IDEA-149513

    这篇关于如何在IntelliJ 15中导入现有的Grails 3(3.0.12)项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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