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

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).

Related

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.

How do I make Grails 2.3.1 notice changes to BuildConfig.groovy?

I've got a Grails 2.3.1 project that compiles and runs fine. But when I add or remove dependencies in BuildConfig.groovy (and then run grails clean, grails refresh-dependencies), the framework simply doesn't notice my changes.
If I introduce a syntax error, my code fails to compile. But my (syntactically valid) changes never even show up in grails dependency-report.
I can "fix" things via rm -rf ~/.grails/2.3.1/projects/myproject.
But that is terrible.
What's the right way to deal with this?
Does it work if you run grails compile instead of clean and refresh-dependencies? If not, and you can create a small app that demonstrates this behavior, run grails bug-report and attach that ZIP to an issue at http://jira.grails.org/browse/GRAILS
Try grails clean-all instead. The regular clean command is not going to clean all files...

RunApp: org/apache/ivy/plugins/resolver/ChainResolver

I'm using Groovy/Grails Tool Suite 3.2.0.RELEASE, Grails 2.2.2 and Groovy Compiler 2.0.
When I try to run an app I get the following error:
Error executing script RunApp: org/apache/ivy/plugins/resolver/ChainResolver
Can anyone help me?
Best regards.
UPDATED
Check your index.gsp file and remove the line showing the Groovy version.
org.codehaus.groovy.runtime.InvokerHelper.getVersion has changed to
GroovySystem.getVersion in newer Groovy builds bundled in Grails.
Initially I would have said that you upgraded projects from previous Grails versions.
Install a new version of Grails
Update the application.properties file
Run grails upgrade
Create a new blank project and compare the BuildConfig.groovy to see if a dependency needs upgrading.
I think that the index.gsp modification will do it. If not, please add details about the actions that you're taking and when the error occurs(stacktrace will also be needed).

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.

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