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

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

Related

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

Error loading UrlMappingsPlugin in Grails

When creating a basic grails plugin and compiling with Maven, I get this error message:
Error loading plugin manager: Could not create a new instance of class
[org.codehaus.groovy.grails.plugins.web.mapping.UrlMappingsGrailsPlugin]!
(Use --stacktrace to see the full trace)
Grails version 2.4.3
The solution to this issue is to add the tomcat plugin (no idea why):
Add this to BuildConfig.groovy:
build ":tomcat:7.0.55"
Then you may need to regenerate the pom.xml file using grails create-pom.
This appears to be related to this bug.

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"
}

error while running grails command line

in my grails 2.3.4 application (after upgrading from grails 2.2.3) , when I run the grails command line grails install-plugin pluginname I get the below error , even I tried grails list-plugins I'm getting the same error:
Error Resolve error obtaining dependencies: Failed to resolve dependencies (Se log level to 'warn' in BuildConfig.groovy for more information): org.grails.plugins:tomcat:2.3.4 (Use --stacktrace to see the full trace)
i reviewed the BuildConfig.groovy there is no tomcat 2.3.4 what i'm using is 7.0.47 , here are my plugins :
runtime ":hibernate:3.6.10.6"
runtime ":jquery:1.8.3"
runtime :resources:1.1.6
build ":tomcat:7.0.47"
runtime database-migration:1.2.1
compile :cache:1.0.1
how i can solve this issue ?
you problem seems slovable due to the fact that ...you need to clean the grails project first without building it and then do
grails refresh-dependencies
and then finally
grails clean
and
grails compile
When you run refresh-dependencies your Grails application will try to resolve your grails plugins defined in BuildConfig.groovy file. If this doesn't work remove the plugins and do the above step until the error you have posted in the question vanished then add the correct plugin format and version with the correct precedence dependency, then make sure everything should work well.
Your dependencies are in a dependency block, but they are plugins. Put them in the plugins block of your BuildConfig.groovy file. So instead of what you have, put this:
plugins {
runtime ":hibernate:3.6.10.6"
runtime ":jquery:1.8.3"
runtime ":resources:1.1.6"
build ":tomcat:7.0.47"
runtime ":database-migration:1.2.1"
compile ":cache:1.0.1"
}
Also, this is no "dependency" block. This is a dependencies block, however. See this link for information on dependency resolution in Grails.
I need to add the following repo in buildconfig.groovy to the repositories section:
mavenRepo "https://repo.grails.org/grails/plugins"

Grails ant tasks don't work - Unable to start Grails: java.lang.reflect.InvocationTargetException

I'm having issues getting something which seems very basic running with Grails. I want to call grails commands from an Ant script - Grails provides a Grails task to achieve this. I have defined the Grails taskdef and classpaths as per the docs however, no matter what command I call I get the same error...
grails-compile:
[grails] Resolving dependencies...
[grails] Dependencies resolved in 1192ms.
BUILD FAILED
/java/grailstest/build.xml:22: Unable to start Grails: java.lang.reflect.InvocationTargetException
Even when I create a new Grails app using 'grails create-app' and then run the integrate ant command 'grails integrate-with --ant' to generate a default build.xml, I get the same error when running any of the tasks in the generated build.xml.
I've tested this with Grails 1.3.1, 1.3.4 and 1.3.5 and am getting the same error.
Has anyone else encountered this problem? There must be something stupid I'm doing wrong or this would never have made it out the door of the Grails factory... ;)
I forgot to mention that I am using Ant version 1.8.1. I have just discovered that switching back to Ant 1.7.1 'solves' this problem but this is not really ideal as I need 1.8.1 for other build tasks. I'll submit a bug on the Grails issue tracker as it seems a lot of people are having the same problem.
I've just found the same issue. It seems that Ant 1.8 is not supported yet (but Ant 1.7 is), see GRAILS-6897. Some users have complained that the documentation does not state it strictly.

Resources