Deploying Grails App In IntelliJ

I'm running IntelliJ 7.0.3 build 7744 using Sun's JDK 1.6.0_04 on Windows XP SP 2. I've installed the JetGroovy and InspectorGroovy plugs. I'm running Grails 1.0.3. I've sorted through some classpath issues and got an app to build using the war Gant task. I can run it under Tomcat 5.5.26 by deploying the WAR. I've been able to set breakpoints and everything. Brilliant, as usual.

But I still have some issues that I don't understand:

(1) I'm not getting a web module automagically. There's nothing to deploy in my app. I couldn't add a web facet to the Grails module, so I manually added a module and gave it a web facet. Is this correct?

(2) I don't see any place where I can issue grails commands. Is the idea that interaction with the command shell is still necessary, or am I still ignorant about how to best use IntelliJ with Grails?

Thanks. - %

15 comments
Comment actions Permalink

Hello, Michael.

1. Could you explain, what do you mean under web module? You can make Grails web archive from your Grails module to deploy it further. For this you have to use Build -> grails Make Web Archive command.

2. Yes, there is no possibility to run arbitrary grails actions from IntelliJ but several in Grails group like "create controller", "create domain class" etc.

0
Comment actions Permalink

Hello, Michael.


Hi Ilya,

Thank you for taking the time to reply.


1. Could you explain, what do you mean under web module? You can make Grails web archive from your Grails module to deploy it further. For this you have to use Build -> grails Make Web Archive command.


Yes, if I'm trying to deploy and run my Grails project inside IntelliJ I have to configure an app server. I have my choice in this case (WebLogic or Tomcat), so I choose Tomcat. Then it asks me which module I'd like to deploy, and unless I take further action there ARE no deployable modules that I can see. Either I've missed something or I have to manually add a new module and give it a web facet. That's the path I've taken to get this to work, but it's not optimal.

2. Yes, there is no possibility to run arbitrary grails actions from IntelliJ but several in Grails group like "create controller", "create domain class" etc.


Sorry, I don't see where I can do those, either. I can run the Gant build.xml to create a WAR file, and I can see that it executes all the appropriate Grails commands.

Are you saying that I can create controller, service, or domain class inside IntelliJ? Where do I do that?

I'll apologize in advance for my ignorant questions. Thanks.

%

0
Comment actions Permalink

Are you saying that I can create controller, service, or domain class inside IntelliJ? Where do I do that?


Right button on a directory in the navigator, New, Grails, then choose controller, service, or domain object.

This is REALLY not obvious. I have no idea how I found it.

In order to run your application within IntelliJ, you shouldn't be creating app server, you should be adding a "Grails Project" in the "Edit configurations" menu. That should handle everything for you a la grails run-app.

0
Comment actions Permalink

Brilliant Ted, thank you. I wasn't thinking the IntelliJ way. I should have known that they'd make this easier. I was fighting it too much. I was too mired in the way I'm used to doing non-Grails projects.

Fantastic! Thanks so much. Sincerely, %

0
Comment actions Permalink

Michael,

BTW we're going to provide interactive Grails console soon to run all possible Grails commands, not only half-dozen of most popular.

0
Comment actions Permalink

Hello Ted,

>> Are you saying that I can create controller, service, or domain class
>> inside IntelliJ? Where do I do that?
>>

Right button on a directory in the navigator, New, Grails, then choose
controller, service, or domain object.

This is REALLY not obvious. I have no idea how I found it.


Where would you expect to find this functionality?

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Hello Dmitry,

>> This is REALLY not obvious. I have no idea how I found it.
>>
DJ> Where would you expect to find this functionality?

I'd disagree with Ted, I had a basic app running in no time when I played
with this (with almost zero previous Grails knowledge), I just created a
Grails facetted module and things were there. Not sure how Grails-like if
feels (having just started to play with these things), but it certainly felt
quite intiutive as an IDEA extension.

My 2c,
Andrei


0
Comment actions Permalink

when? will it be a version 7 addition or do we have to wait for 8?

0
Comment actions Permalink

I'd disagree with Ted, I had a basic app running in no time when I played
with this (with almost zero previous Grails knowledge), I just created a
Grails facetted module and things were there. Not sure how Grails-like if
feels (having just started to play with these things), but it certainly felt
quite intiutive as an IDEA extension.

My 2c,
Andrei


Now that I see it I agree with you, Andrei. I was fighting it too much.

%

0
Comment actions Permalink

Michael,

BTW we're going to provide interactive Grails console soon to run all possible Grails commands, not only half-dozen of most popular.


Brilliant stuff. Thanks so much. - %

0
Comment actions Permalink

Where would you expect to find this functionality?


That is a really good (and as you know, hard) question.

I would look for the create commands in these places

a) under the new menu where you have it (especially now that I know)

b) startup tips, especially if I have done any groovy things

c) under the code menu

d) in the help system

e) in an interactive tutorial

I would look for the build-like commands under the run configurations and under the build menu. The fact that make and make grails war are not closely integrated has caught me out a few times.

Don't get me wrong. I like the current system. I just had a bit of a hard time finding things and have observed that a new programmer on our staff (new to IntelliJ as well) was completely clueless about how to proceed. Your tutorials are really excellent in this regard, but links to them don't seem to appear in the IDE.

I hope this helps!

0
Comment actions Permalink

Most likely, that we'll implement this functionality only for Diana version. But it's not necessary to wait for final release of IDEA 8. Diana EAP is already available. You can download and tr yit.

0
Comment actions Permalink

Was the grails console ever added? I don't see it in version 9M1

0
Comment actions Permalink
You can use Tools | Run Grails target... (Ctrl + Alt + G)

--
Maxim Medvedev
JetBrains,  Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
0
Comment actions Permalink

Hi Maxim,

Is it possible to create deployment package via context menu (In Grails view, right click on the root node then select Grails | Create WAR, or something similar)? Or is Tools | Run Grails target... (Ctrl + Alt + G) only option?

Thanks

0

Please sign in to leave a comment.