Grails 3.2.9 setup issue in Windows - grails

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

Related

"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

Error installing Grails plugin to local maven repository

I have created a Grails plugin using Grails 2.3.3 and trying to use the plugin in a Grails application which was also created using Grails 2.3.3. Now, to use the plugin in the application, it needs to be published to a plugin repository first. So I attempted to publish the plugin into the local repository by using the commands:
grails clean
grails compile
grails maven-install
For the grails maven-install command I selected the option 2)InstallPlugin. But then got an error:
Error installing plugin: No such property: ERROR_MESSAGE for class: Inst
allPlugin (Use --stacktrace to see the full trace)
Ran the last command above with option --stacktrace and --verbose but did not get any clue as to what the problem might be. I also removed %HOME%/.grails directory and reran the above commands and still came with the same error.
After googling, I found a JIRA for this issue which was closed stating that it happens when Grails version is changed and cleaning up cache files will get rid of this issue. However, that solution is not working for me and, by now, I have spent couple of hours trying to fix this. Also I did not change my Grails version.
Has anyone faced this issue with Grails 2.3.3 or with any recent version of Grails? What was the solution?
Don't use install-plugin, add a dependency in BuildConfig.groovy.
I don't know where the 2)InstallPlugin "option" is coming from. The maven-install script packages your plugin and generates a POM file and the other files needed to be a valid published plugins. Then it copies these files to your local M2 directory, e.g. if your plugin name is "mycoolplugin" the files are copied to $HOME/.m2/repository/org/grails/plugins/mycoolplugin
Now you can "install" the plugin as if it had been published in a remote repo. Add a dependency in the app's BuildConfig.groovy using the usual format, e.g.
plugins {
build ":tomcat:7.0.50"
compile ":scaffolding:2.0.1"
runtime ":hibernate:3.6.10.7"
...
compile ":mycoolplugin:0.1"
}

Not able to compile grails project

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.

Grails 2.3.0 Not Running

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

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