Not able to compile grails project - grails

I am unable to clean, compile my individual grails project .
If I try running compile --stacktrace or --verbose on project 'X_Project' throws me the below error
Problem executing: compile --stacktrace
The command 'GrailsCommand(P/X_Project> --noreloading compile --stacktrace)' was terminated because it didn't produce new output for some time.
See details for the output produced so far.
If you think the command simply needed more time, you can increase the time limit in the Grails preferences page.
See menu Windows >> Preferences >> Grails >> Launch
Command: GrailsCommand(P/X_Project> --noreloading compile --stacktrace)
---- System.out ----
Loading Grails 2.2.3
---- System.err ----
Couldn't collect a stacktrace because Grails process was not found
------System.out:-----------
Loading Grails 2.2.3
------System.err:-----------
Couldn't collect a stacktrace because Grails process was not found.
I'm a bit lost at the moment.Maybe someone can give me a hint about where to search for the error/problem.
Version am using : Grails 2.2.3 , Groovy/Grails Tool Suite Version: 3.3.0.RELEASE.
Thanks in advance...

First thing that I would try is to run Grails project on it's own from a console. Make sure that your OS has correct path to grails installation. Go to the project folder and run: grails run-app
If it runs from console then you know the issue is in the IDE. Now you have a decision to make: run Grails project from console or use IDE - your choice. Here are my 2 cents:
Now I am not a big fan of Groovy/Grails Tool Suite in the first place. When I used Eclipse, I use to install Eclipse separately and then install Groovy & Grails plugins. This approach allows you to have a "standard" Eclipse without any restrictions and run Groovy & Grails without being constrained to a specific version. Now having said that you can try the approach.
If you don't want Eclipse, you can always use IntelliJ - it plays very well with Grails. IMHO it is working better with Grails than Groovy/Grails Tool Suite.

Related

How to enable grails for Intellij Community 2016.2.5

I just installed intellij community 2016.2.5 in mac, and tried to create a grails project. It does not show grails as an option, but shows Groovy, Gradle, Griffin.
I went to the intellij grails page and it says:
Also, make sure that the Grails plugin is enabled in IntelliJ IDEA. The plugin is bundled with IntelliJ IDEA and is activated by default
Then, I tried to enable the plugin, or find in repositories, but didn't find any, only a Grails Tools, that is not from jetbrains, and after a install and restart, still don't show anything.
Anyone has used this lastest version with Grails? Has any solution or workaround to make it works? Should I download some older version?
Thanks.
Here is how I import a Grails 3 app into community edition:
First use SDKMAN to get grails - http://sdkman.io/install.html
sdk use grails 3.2.1
grails create-app mytestapp
Then import existing project, select the build.gradle file
Check Use Auto Import
Use gradle wrapper
You can run it by using the bootRun gradle task in the gradle toolbar or going to the Application.groovy file and running the main() method.
To see some of the run configs in action you can watch https://www.ociweb.com/products/grails/grails-quickcast-6-developing-grails-3-applications-with-intellij-idea/ - Though I would recomend running gradle from inside intellij, not via the command line. That was just to show how remote debugging works.
With community you lose some features, but it does work well.

Bamboo/grails error 2.4.4 Error Script not found: Upgrade

When I run grails war, on Bamboo, I get the following error.
13-Apr-2015 11:15:53 | Configuring classpath
13-Apr-2015 11:15:59 | Running pre-compiled script
13-Apr-2015 11:15:59 | Error Script not found: Upgrade
Now I know that grails upgrade command has been removed from 2.4.4 so this is the cause but why is it (Upgrade) calling it in Bamboo. I have updated grailsw and grailsw.bat to be 2.4.4 but is still calling it? My app is set to 2.4.4 (application.properties). What could be the reason it is calling this(Upgrade) and/or how do I stop it?
From what I can tell, being in the same boat, the grails plugin itself is calling grails upgrade before running any commands you put in there.
The way I've got this working with 2.4.4 is to use a command instead of the build-in grails task.
My command simply maps to C:\grails\grails-2.4.4\bin\grails.bat and I just pass it command line args: -Dgrails.env=alpha war myApp-alpha.war
It's not as seamless doing multiple commands (like, clean -> test-app -> war), but you can do individual commands for each one, depending on the needs.
It looks like, its a Bamboo plugin for Grails has some bug.
For work around:
You! Could have added dummy upgrade script into your code.
For adding upgrade script:
grails create-script upgrade
After adding upgrade script, it will fix missing upgrade script issue on Bamboo.

Using Grails 2.4.3 in IntelliJ

I've been unable to create/import a Grails 2.4.3 project with IntelliJ 13.1.4. For example, when I create a new module, choose Grails, then click the create button (highlighted below) and choose the location where Grails 2.4.3 is installed, the project is not created correctly (I get a module with just a /src directory instead of a Grails project) and Grails 2.4.3 is not added to the list of Global Libraries. I don't have this problem with any earlier version of Grails.
I have used Grails 2.4.2 with Intellij 13.1.4 successfully. What I did is create the application with the grails create-app command and then do a File / Import Project in Intellij. Give that a try.
As an alternative solution to the IntelliJ 13.1.4 and Grails 2.4.3 bug you can:
grails create app <app-name>
cd app-name
grails integrate-with --intellij
This configured the project correctly for me with just minor tweaks to SDK and application server. This is a minor twist on the work around described above.
See grails doc here
I had the same problem with IntelliJ 13.1.4 and Grails 2.4.3, which i just downloaded.
After using the grails create-app command from the command line i had to import the project, by "create from existing sources" (point to the new top level folder), "Configure SDK" (to set for the Grails 2.4.3) and finally edit the run configuration. In a second test run with a new test project i did not have too configure the run config.
Then the Grails libs for the were downloaded and the basic app ran. Also the Grails specific option in the Intellij "Tools2 section were suddenly available.
So the given answer by Joe is the way to setup a new Grails project but the IDE should be fixed anyways.
It is not consistent. After several tries I can get some applications to work but it does not seem to be automatic. I think I am going to go back to Grails 2.4.2 until this is resolved within Intellij 13.1.4.
In the screenshot above, there are options for groovy/grails/griffon, and so far the alternative offered was command-line. Try choosing groovy option within intelliJ.
We are using IDEA 13.1.4 with grails 1.3.7 and grails 2.2.1(diff projects) and saw the same issue. It appears this is an intelliJ issue and not so much the grails version, so reverting your grails won't gain you anything. Choosing groovy, you should see a prompt for grails directory structure. This does work if you are presented with this option. Seeing inconsistencies here. Thanks to all for posting your workarounds; never hurts to have multiple approaches.
-Duane

The command '\bin\javaw.exe' was terminated because it didn't produce new output for some time

I have downloaded my grails project from SVN and tried to run it.Project Using grails 2.0.4 version.I'm using STS 3.0 version.I have set the JAVA_HOME properly and added the proper grails compiler in the STS.
When i try to run the project it throws the following error and build not starting up
The command '\bin\javaw.exe' was terminated because it didn't produce new output for some time.
Can anyone please help?
It's a problem related with the way Grails executes multiple commands through a single external process. If you are in Eclipse (+GGTS plugin), go to "Windows > Preferences > Groovy > Grails > Grails Launch", then disable the "Keep External Grails Running" option.
This is also happening in GGTS.
My workaround to this is to create Run Configuration. Open Run Configurations, double click Grails, it will create new Grails configuration. Rename it, select your project and enter grails command: run-app. Click Apply or Run.
On the top toolbar where you have run configurations drop-down, it should include your new configuration. Running this way will not timeout.
This STS issue is kinda-related. Windows >> Preferences >> Grails >> Grails Launch is the place where you can find all the options.
I was getting this problem when I tried to use run-app from the grails command line. Try using the Run menu instead.
Run -> Run As -> Grails Command (run-app)
See this ticket.
I meet same problem when I try run war on my project. I fixed it by change setting in
Windows -> Preference -> Groovy -> Grails -> Grails Launch -> Grails Command Timeout[ms]
Change the timeout time to a big value.

Grails always tries to uninstall plugin

Each time I'm runnin Grails app, it tries to uninstall an plugin (resources-1.2.RC2). When it installed using IntelliJ IDEA, it uninstall it sucessfully, I see:
| Uninstalled plugin [resources]
and fails with:
| Error Fatal error during compilation org.apache.tools.ant.BuildException:
srcdir "***/2.1.1/projects/***/plugins/resources-1.2.RC2/grails-app/resourceMappers"
does not exist! (Use --stacktrace to see the full trace)
Notice, that I can install this plugin only by using InteliJ IDEA, when I'm trying to install it from command line (using grails install-plugin resources) it logs only:
| Plugin not installed.
If plugin isn't installed, and i'm doing grails run-app, it writes (each time!):
| Warning No plugin [resources-1.2.RC2] installed, cannot uninstall
app fails because cannot find required classes from resources plugin.
--
I guess it's happening because of corrupted config inside ~/grails (I've tried to uninstall it some time ago), and it execute this action on each run. But I can find.
I even tried to remove project dir from ~/.grails/2.1.1/projects - not helped.
How I can stop it from removing this plugin? Whre grails stores infomration what plugin it shoud uninstall?
PS Also, I can't understand, why plugins { compile ":resources:1.2.RC2" } in BuildConfig.groovy not used by grails? I always need to run install-plugin command to make it working?
Actually, install-plugin is deprecated. Use BuildConfig.groovy instead. To get everything set up properly, delete all plugins from your application.properties file. Then add them to your BuildConfig.groovy.
IntelliJ is not really good with catching these kind of updates, so you might have to run refresh-dependencies manually after updating your BuildConfig. That is properly why it didn't work before.

Resources