How to import grails 3.3.8 project into intellij Ultimate?

已回答

I have been using the excellent netbeans 9 with grails, but netbeans is missing one feature - support for multi-module grails apps (i.e. a main app which depends on an exploded plugin containing the common services/domain classes).

The project structure is like this:

    myproject

         settings.gradle

         myapp

                build.gradle

         myplugin

                build.gradle.

 

I have tried both importing the settings.gradle at the top level, which didnt work, and also importing the "myapp" dir which didnt recognise it as a grails project.

Should I be "opening" or "importing"?

With netbeans its trivial, you just open the myapp dir and everything appears as a proper grails structure.

How do I do the same in intellij?  how can you open a grails app, then tell the ide that its grails, then get it to pick up the dependent projects (which are all defined in the build.gradle and settings.gradle, but I am guessing its not intelligent enough to get it from those).

settings.gradle contains one line: include "myapp", "myplugin"

0

OK, after some trial and error I got further, but still no joy.

I imported the settings.gradle. It could not find gradle despite me having set GRADLE_HOME and having gradles bin dir on the mac PATH. Going with the "wrapper" seemed to work.

Now I have myapp and myplugin in intellij as a grails app.  However, if I try to run it within intellij, I get: 

 

|Running application...
objc[50919]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java (0x10ca924c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10cb1e4e0). One of the two will be used. Which one is undefined.
2019-01-16 00:18:52.947 ERROR --- [ main] g.plugins.DefaultGrailsPluginManager : ERROR: Plugin [domainClass] cannot be loaded because its dependencies [['i18n']] cannot be resolved

 

It cant find i18n. However, if I cd into myapp and type "grails run-app" it works. If I open myapp and myplugin in netbeans 9,. and run it it works.  only intellij cant run it for some reason.

 

Any ideas?

 

0

>However, if I cd into myapp and type "grails run-app" it works. 

Looks like the working directory when running graild run-app command is set to the directory of settings.gradle file (which corresponds to the Gradle behaviour). Please try to move settings.gradle to myapp directory. Does it help?

0

请先登录再写评论。