Grails 2.3.0 Not Running - grails

I have Grails 2.3.0, and when I run the command run-app I get this message:
> | Error Error executing script RunApp:
> _GrailsClasspath_groovy$_run_closure1 (Use --stacktrace to see the full trace)

Delete target folder from your app directory.
delete .grails/.slcache folder (is in your /home).
Try grails run-app again.

Do not work for me. I had to delete the ~/.grails/$version/projects/$projectName/scriptCache directory files.
And execute grails clean, before execute grails run-app again.

I ran into this issue with GGTS 3.4.0 and Grails 2.3.1. Following these steps resolved it for me:
Delete <workspace>\ggts-3.4.0.RELEASE\.metadata\.plugins\org.grails.ide.eclipse.core\2.3.1\.slcache
Run clean
Run run-app

What worked for me is to totally empty the .grails directory under my home directory

Do a grails clean first. followed by a grails compile and finally grails --stacktrace --verbose run-app
Also make sure you copied the new BuildConfig into your conf directory. I had problems until I did that. The file has a lot of new config that can affect the way things are run
Hope that helps

Related

Grails 3, how to run projects which had an older grails version

here is a grails project, but if you have grails 3.3 installed, and try to run it with "grails run-app" it throws the error:
| Error Error initializing classpath: Unsupported method: GrailsClasspath.getError().
The version of Gradle you connect to does not support that method.
Any ideas how to run it? Do I have to find, install, then change my paths to point to the old version, or is there some other way using gradle?
I see there is something called gradlew.bat, but looking through the grails docs, it doesnt say how to use it. is gradlew.bat like the grails command line, and, if so, where is it documented on how to use it?
Any ideas how to run it?
./gradlew bootRun
Do I have to find, install, then change my paths to point to the old
version, or is there some other way using gradle?
No, you don't have to install Gradle and you don't have to do anything with your PATH. That is the point of the wrapper (gradlew).

Grails 3.2.9 setup issue in Windows

I am moving from grails 2.5.1 to grails 3.2.9 (On Windows). I downloaded the latest zip file for grails 3.2.9. Then changed GRAILS_HOME to point to the new version and changed PATH to have GRAILS_HOME\bin.
I then executed
grails --version to confirm that the right version of grails is running.
I then created a grails app using
grails create-app bgrt2
When i execute the grails app using
grails run-app, I get a gradle error pasted below. Any help is appreciated.
C:\work3\bgrt2>
| Resolving Dependencies. Please wait...
FAILURE: Build failed with an exception.
Where:
Build file 'C:\work3\bgrt2\build.gradle' line: 19
What went wrong:
A problem occurred evaluating root project 'bgrt2'.
org/springframework/util/ReflectionUtils
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
CONFIGURE FAILED
Total time: 6.631 secs
| Error Error initializing classpath: org.springframework.util.ReflectionUtils (Use --stacktrace to see the full trace)
Firstly remove all the cached files in the Gradle cache location
C:\Users[Your_Username].gradle\caches
Then run this command to refresh you gradle
gradle --refresh-dependencies build
N.B. Grails 2 and Grails 3 is fully different where there is no config.groovy in Grails 3. You need to configure everything in application.yml
You need to define your project name in application.ymlat line no. 5 as like
defaultPackage: bgrt2

IntelliJ Grails 3 Project: Unable to Run Grails project

I recently installed IntelliJ onto my machine after many unsuccessful attempt to get GGTS working reliably. So far the error messages were clear and easy to resolve after I imported my Grails project. GGTS had forced me to downgrade from Grails 3 to 2 because, at the time, GGTS does not seem to support Grails 3. I ran into issues after pointing IntelliJ to Grails 3, but restarting IntelliJ seemed to fix those problems. Now, however, I can't get my project to start and I get the following error:
"C:\Program Files\Java\jdk1.8.0_51\bin\java" ...;C:\dev\grails-3.0.4\lib\xalan\serializer\jars\serializer-2.7.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.grails.cli.GrailsCli run-app
Error |
Problem updating profiles from origin git repository (Use --stacktrace to see the full trace)
Error |
Could not checkout tag for Grails release [3.0.4]: repository not found: C:\Users\Randeep\.grails\repository (Use --stacktrace to see the full trace)
Error |
Error occurred running Grails CLI: No profile found for name [web]. (Use --stacktrace to see the full trace)
Process finished with exit code 1
Note the "Problem updating profiles from origin git repository" message. This is a git project, but I don't know why IntelliJ is trying to do any git operations (I don't want it to, I just want it to run my project).
There's a lot going on behind the scenes with grails here. The CLI (command line interface) is trying to load a profile called web. Basically grails creates a .grails folder in your home directory that contains a set of default profiles (see ~/.grails/repository/profiles).
Somehow this folder got corrupted or modified on my system and the web profile, which is the default profile, disappeared. To fix this I simply deleted the .grails folder from my home directory, ran grails, and it regenerated.
Edit: Deleting your .grails folder may have undesirable behavior if other projects are using data within it, so try deleting the profiles folder first.
I got this error message too after I delete ~/.grails ~/.gradle from my home directory.
Thoses directories seems won't created again for some reason, and grails clean isn't work at the same time.
This how I fixed it, hope it helps.
set up JAVA_HOME / GRAILS_HOME variables.
cd GRAILS_HOME (ie. /etc/grails/grails-3.1.4 )
execute 'bin/grails'
create-profile web
grails will try to create a new web profile, and start downloading dependency jars.
exit. & done.
ps. my environment.
jdk 1.7.0_4
grails 3.1.4
IntelliJ is trying to download a Grails profile called 'web' and it is unable. Enable --stacktrace and dig into the problem.
Or Create a new project in IntelliJ and point it to your source.
Note: Your project should be a Grails 3.0.X to use profiles.
I stumbled across this question when my Grails 3.2.8 app was reporting a similar problem for react.
Error occurred running Grails CLI: No profile found for name [react]
I do not have a .grails/profile folder, for whatever reason, and didn't want to trash the whole .grails folder right off the bat, so I ended up :
reimporting my project into the IDE
refreshed the grails dependencies
cleaned the grails project
and it worked for me.

"No builders" error GrailsClasspath when running grails run-app

When running grails run-app I get the following error:
| Error Error initializing classpath: No builders are available to build a model of type 'org.grails.gradle.plugin.model.GrailsClasspath'. (Use --stacktrace to see the full trace)
Any ideas anyone?
This is logged as an unresolved issue presently: https://jira.grails.org/browse/GRAILS-12079
I'm seeing this same issue with both grails 3.0.11 and 3.1.1. I was able to get around it for my project by installing grails 2.4.5 then executing grails set-grails-version 2.4.5.
Just had the problem where i took an existing grails project. That grails project was specified as 3.0 but actually contained many references to 2.5 in the build.gradle
Had To make changes to the gradle configuration to make it run.
To get you on track: create a new app somewhere and compare the gradle configuration between the 2

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