Grails 2.3.0.M1 - upgrade not working - grails

I am getting some error while upgrade. What I did was:
I downloaded Grails 2.3.0.M1, extracted, and changed in Eclipse -> Preferences->Groovy->Grails also.
Changed the Groovy compile 1.8 to 2.0.7
I check out my Grails app from svn, it already working app with Grails 2.14.
I changed this one in BuildConfig.groovy
forkConfig = [maxMemory: 1024, minMemory: 64, debug: false, maxPerm: 256]
grails.project.fork = [
test: forkConfig, // configure settings for the test-app JVM
run: forkConfig, // configure settings for the run-app JVM
war: forkConfig, // configure settings for the run-war JVM
console: forkConfig // configure settings for the Swing console JVM
]
grails.project.dependency.resolver = "maven" // or ivy
Finally I run grails upgrade, I am getting error like this:
Error org.sonatype.aether.collection.DependencyCollectionException: Failed to collect dependencies
So, I removed the previous added lines from BuildConfig.groovy.
Now, Grails upgrade, is working fine. But it downloading lot of jars into ivy-cache.
Once the upgrade is done (success). If I add then again I add those lines to BuildConfig.groovy, everything is working fine.
But, the problem is, I should able to do upgrade in the first time itself. First time even not only upgrade even Grails clean also not working. After upgrade is done only any Grails commands working.

This issue is due to changes in dependency resolution as explained here:
http://grails.org/doc/2.3.0.M1/guide/upgradingFromPreviousVersionsOfGrails.html
For me, resolving this issue boiled down to these simple steps:
In build.config
1.) Add the following line:
grails.project.dependency.resolver = "maven"
2) Change the plugin dependency version of Tomcat
From: build ":tomcat:$grailsVersion"
To: build ":tomcat:7.0.40.1"
3) Change the plugin dependency version of Hibernate
From: runtime ":hibernate:$grailsVersion"
To: runtime ":hibernate:3.6.10.M3"
As the documentation states:
If you are upgrading from Grails 2.2 you need to manually configure
the correct Tomcat and Hibernate plugins in BuildConfig. The upgrade
command will not do this for you!
Hope this helps...

Related

Grails 2.4 reloading and debugging don't work at the same time

I'm trying to debug my spock tests using the following method, which used to work in Grails 2.3, but no longer does in 2.4.4:
Start grails in a terminal with: grails-debug -reloading -Dvar=blah
Start remote debugger in Intellij
Rejoice as I can run tests from the grails console, debug them, modify services and have them auto-reloaded.
Since grails 2.4, the grails-debug script is gone, replaced with grails -debug. But what I've found is that -debug only works if it's the first argument, and then it ignores the -reloading argument. And while changes to the test itself is reloaded, changes to services that the test uses are not.
So I can debug without reloading. If -reloading is the first argument, then reloading of services works, but I can no longer debug.
All of the above using non-forked execution.
An added complication for forked execution is that I need to pass -Dvar=blah to my app, and there doesn't seem to be a mechanism to do this with forked exec. So I've disabled forked exec by commenting out the section in BuildConfig.groovy entirely:
grails.reload.enabled = true
//forkConfig = [maxMemory: 1024, minMemory: 64, debug: true, maxPerm: 256]
//grails.project.fork = [
// test: forkConfig, // configure settings for the test-app JVM
// run: forkConfig, // configure settings for the run-app JVM
// war: forkConfig, // configure settings for the run-war JVM
// console: forkConfig // configure settings for the Swing console JVM
//]
and also tried:
grails.reload.enabled = true
forkConfig = [maxMemory: 1024, minMemory: 64, debug: true, maxPerm: 256]
grails.project.fork = [
test: false, // configure settings for the test-app JVM
run: false, // configure settings for the run-app JVM
war: false, // configure settings for the run-war JVM
console: false // configure settings for the Swing console JVM
]
In neither case, can I both debug tests and have them reload services at the same time.
My question is: With Grails 2.4.4 and Intellij ultimate 13.1.5 how can do all of the below at the same time:
Run individual spock integration tests from the grails interactive console (I don't want to restart the whole grails environment for every test)
Pass system properties to grails on the command line
Debug those tests in Intellij
Make changes to services and have them automatically reload
(I'd be happy to use forked exec if that's what solves this, but then need a mechanism to pass properties to the forked debug session)

Grails Standalone Plugin Not Found

I'm trying to use the grails standalone plugin with a new grails project but I can't get it to work.
I've added it as a plugin dependency in my BuildConfig.groovy file:
plugins {
compile: ":standalone:1.2.3"
}
But I get the following error when I attempt to run grails prod build-standalone:
Script 'BuildStandalone' not found, did you mean:
1) InstallDependency
2) Stats
3) InstallJQuery
4) CreateMultiProjectBuild_
5) TestApp
I tried running grails clean, grails clean-all, grails refresh-dependencies, and grails compile as answered in this question, but nothing seems to help. I would expect refresh-dependencies to either download the necessary artifacts or fail trying.
What am I doing wrong?
Here is my environment:
Mac OS X 10.9.5
JDK 1.8.0_05
Grails v2.4.4 installed with GVM
Always run grails compile after editing dependencies in BuildConfig.groovy; this triggers dependency resolution and installs the plugin, downloads the jars and adds them to the classpath etc. Once that happens the plugins' scripts will resolve.

How to upgrade from 2.2.4 to 2.4.3

I am trying to upgrade from 2.2.4 to 2.4.3
What is the best way to do this? I've made the following changes to my BuildConfig.groovy
plugins {
runtime ':hibernate4:4.3.5.2'
runtime ':jquery:1.11.0.2'
runtime ":jquery-ui:1.8.24"
//runtime ":resources:1.2"
runtime ':twitter-bootstrap:3.2.0.2'
compile ':spring-security-core:2.0-RC4'
compile ":rabbitmq:1.0.0"
compile (":events-push:1.0.M7") {
excludes "resources"
}
compile ":rest-client-builder:1.0.3"
test(":spock:0.7") {
exclude "spock-grails-support"
}
build ':tomcat:7.0.52.1'
runtime ':database-migration:1.4.0'
compile ':cache:1.1.3'
compile ":pretty-time:0.3"
compile ":tagcloud:0.3"
compile ':asset-pipeline:1.8.3'
}
After making the changes what command do I need to run? Are there changes I need to make now that since resources plugin is replaced with asset-pipeline
I've also changed app.grails.version=2.2.4 in application.properties to 2.4.3
Firstly, we can't actually see any of the changes you've made.
Are there changes I need to make now that since resources plugin is replaced with asset-pipeline
You can continue using the resources plugin in Grails 2.4.3, but if you want to migrate to the asset-pipeline, I'd advise you to do that after you have your app running stably on Grails 2.4.3.
After making the changes what command do I need to run
grails test-app to automatically test if your app is still working. If you don't have any tests, run grails run-app and manually test it.

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"

How to migrate Grails 2.1 to Grails 2.3 application?

I am migrating my application from Grails 2.1 to 2.3. I am getting lot of errors after migration - I want some sample applications with Grails 2.3 and Spring integration.
I did some HelloWorld sample applications, and those are working fine. But even I apply same thing in my application, even some where it is giving error. Because my application is very big(100mb) and i am using lot of integration with Spring, Hibernate, and lot of Grails plugins.
I did not find any code level document for "Migrate from Grails 2.1 to Grails 2.3" like that. I am not able to find any sample applications from Grails or online.
Grails official documentation, all about providing Grails META information.
In my main.gsp 229 line:
<g:include controller="filter" action="tree"/>
Caused by: org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error processing GroovyPageView: Error executing tag <g:include>: Unable to execute include: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: java.lang.IllegalStateException: Cannot reset buffer after response has been committed
at org.codehaus.groovy.grails.web.servlet.view.GroovyPageView.createGroovyPageException(GroovyPageView.java:205)
at org.codehaus.groovy.grails.web.servlet.view.GroovyPageView.handleException(GroovyPageView.java:182)
at org.codehaus.groovy.grails.web.servlet.view.GroovyPageView.renderWithTemplateEngine(GroovyPageView.java:153)
at org.codehaus.groovy.grails.web.servlet.view.GroovyPageView.renderMergedOutputModel(GroovyPageView.java:84)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:264)
at org.codehaus.groovy.grails.web.sitemesh.SpringMVCViewDecorator.render(SpringMVCViewDecorator.java:67)
... 51 more
Caused by: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag <g:include>: Unable to execute include: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: java.lang.IllegalStateException: Cannot reset buffer after response has been committed
at org.codehaus.groovy.grails.web.pages.GroovyPage.throwRootCause(GroovyPage.java:531)
at org.codehaus.groovy.grails.web.pages.GroovyPage.invokeTag(GroovyPage.java:475)
at sun.reflect.GeneratedMethodAccessor379.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1243)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:989)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at mycompany_dev_testuserdev_ws3_myapp_grails_app_views_layouts_main_gsp$_run_closure2.doCall(main.gsp:229)
Compare your Config.groovy and BuildConfig.groovy files to the defaults of an empty new Grails 2.3 application.
The most notable change is that plugin dependencies should not be described in application.properties any more. You should also make sure that you are using the correct version of Grails Tomcat, Hibernate and Scaffolding plugins. Tomcat & Hibernate plugin versions no more are the same as the Grails release version. Scaffolding features have been extracted to separate plugin in Grails 2.3 .
Make also sure you use correct scope for plugins (build for tomcat, runtime for hibernate).
It's also recommended to start using the new maven based (uses aether library which is part of maven) dependency resolution. This is done with the setting grails.project.dependency.resolver = "maven" in BuildConfig.groovy . I ran in to strange classloading problems with the old ivy based resolver in Grails 2.3 .
I hope this helps.
It very simple to migrate Grails 2.3 -(My case , i am using ivy, pom in Grails 2.1.4)
Do a sample project and run - confirm it working. Keep it as reference.
In your project, move all the jars and plugins from pom to BuildConfig, there is no new formats, as usual that you know already. (Note: Don't miss even one jar or plugin, It will take days to realize that, i did same mistake costs 1 and half day.)
And, copy jars and plugins configurations from SampleProject -> BuildConfig to your project BuildConfig, If you have same jars in you app also, check and remove old versions and kept the latest one.
After copy this in BuildConfig
forkConfig = [maxMemory: 1024, minMemory: 64, debug: false, maxPerm: 256]
grails.project.fork = [
test: forkConfig, // configure settings for the test-app JVM
run: forkConfig, // configure settings for the run-app JVM
war: forkConfig, // configure settings for the run-war JVM
console: forkConfig // configure settings for the Swing console JVM
]
grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolution = {
run Grails upgrade
run Grails run-app

Resources