[英]setup Grails project in IntelliJ IDEA
I have the following directory structure 我有以下目录结构
--my-app
|
|--main-app
|
|--plugins
|
|--plugin1
|
|--plugin2
In grails-app/conf/BuildConfig I've added the necessary configuration to ensure that the plugins are loaded from the plugins
directory, so that when I run the application, it picks up the most recent changes. 在grails-app / conf / BuildConfig中,我添加了必要的配置以确保从plugins
目录加载plugins
,这样当我运行应用程序时,它会获取最新的更改。
I'm trying to set this up as a single project in IntelliJ which has 3 modules, one for the main application and one for each of the two plugins. 我试图将它设置为IntelliJ中的单个项目,它有3个模块,一个用于主应用程序,另一个用于两个插件。 I tried the following: 我尝试了以下方法:
Generate the IntelliJ project files 生成IntelliJ项目文件
cd my-app/main-app
grails integrate-with --intellij
Open the generated .ipr file from inside Intellij (File | Open Project...). 从Intellij(File | Open Project ...)中打开生成的.ipr文件。 This adds the main application and plugins as Grails modules 这将主应用程序和插件添加为Grails模块
However every time I open a class from a plugin, IntelliJ reports that the class has two occurrences. 但是每次我从插件中打开一个类时,IntelliJ都会报告该类有两次出现。 It seems each plugin class is being detected 似乎正在检测每个插件类
main-app-grailsPlugins
在我的例子中,这个模块名为main-app-grailsPlugins
In the project structure view I tried removing the content roots for plugin1
and plugins2
from main-app-grailsPlugins
, but they get automatically added back again. 在项目结构视图中,我尝试从main-app-grailsPlugins
删除plugin1
和plugins2
的内容根,但它们会自动重新添加回来。
Is there a way to prevent this, or some other way of correctly setting up an IntelliJ project for a Grails app with in-place plugins. 有没有办法防止这种情况,或者为使用就地插件的Grails应用程序正确设置IntelliJ项目的其他方法。 I'm using Grails 1.3.7 and IntelliJ 10.5.4 我正在使用Grails 1.3.7和IntelliJ 10.5.4
With IntelliJ IDEA 12 Ultimate this is very easy: 使用IntelliJ IDEA 12 Ultimate,这非常简单:
"File" --> "Import Project..." --> select your grails application, "OK" --> Select "Create project from existing sources", "Next" --> "Next" --> "Next" --> Select JDK, "Next" --> Select grails version, "Next" --> "Finish"
The inplace plugins will automatically be added as modules. inplace插件将自动添加为模块。 Result: http://d.pr/i/YHkk 结果: http : //d.pr/i/YHkk
The following has worked beautifully for me in a similar situation: 在类似情况下,以下内容对我来说非常有效:
Make sure that your local plugins are referenced correctly: 确保正确引用了本地插件:
grails.plugin.location.MyPlugin= "../plugins/MyPlugin"
This does it for me with many more plugins than two! 这对我来说有更多的插件而不是两个!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.