The project I've been working on needs to upgrade it's grails version from 2.2.3 to 2.5.1. Needless to say, the project is huge and I am sure there will be lots of issues while upgrading.
What are the precautions needed while upgrading? And what are the changes required in the dependencies below:
dependencies {
runtime 'mysql:mysql-connector-java:5.1.34'
compile ('ar.com.fdvs:DynamicJasper:5.0.0')
compile ('org.apache.poi:poi:3.10-FINAL')
compile ("com.aspose:aspose-words:14.5.0")
compile ("com.aspose:aspose-cells:8.4.2")
}
As well as in plugins below:
plugins {
compile ":aws-sdk:1.6.7"
compile ":export:1.5"
}
You can find the high level changes listed for each major release up to 2.5.0 in the 2.5.1 documentation.
You will need to note all of the features which will change during the upgrade, identify where you are using them and plan how you are going to migrate.
What I usually do when upgrading the Grails version (apart from reading the upgrade sections of the version I'm upgrading to and all in between major versions) is create a new empty application with the new Grails.
And then use a tree compare tool (like meld) and compare all the build and configuration files to see what has changed.
This way you get most of the needed changes without much trouble. You still need to test your application thoroughly. Hopefully you have lots of unit and integration tests to help you with that...
Related
We have upgraded our project from grails 1.3.7 to 2.4.4 version. In this we are facing some issues. Each and every time when we do some changes in controllers or services, we have to recompile the entire project once again. So that our development time gets affected. Currently using grails 2.4.4 version and STS 3.6.4 as IDE. Using older grails versions 1.3.7 and 2.2.4, this problem does not arise.
What's the solution to overcome this recompiling problem? How to make the changes to be affected without recompiling each and every time.
Is there any alternative IDE to work with grails 2.4.4 to overcome this recompiling issue, if this issue persists in STS 3.6.4 IDE.
Thanks in Advance!!
What error are you seeing, when you say "we have to recompile the entire project once again"?
I have a Grails 2.4.4 project where there is a (temporary) conflict between the maven repository and the local 'lib' folder, and this causes a 'ClassNotFoundException' error unless you do 'grails clean refresh-dependencies'.
A workaround that I discovered for that is to save a meaningless change to BuildConfig.groovy, like adding text to a comment line in BuildConfig each time before doing 'run-app' or 'test-app'. Then that 'ClassNotFoundException' goes away.
I'm trying to run a Grails Application from the Grails In Action website. I've imported the 'hubbub' project into the GGTS app and have encountered build errors. The project was originally built with Grails 2.3.7 whereas I have version 2.4.4 on my system. Based on another Stack Overflow question I've changed the 'app.grails.version' in the application.properties file to grails version 2.4.4 which prompted a flurry of downloads in the command prompt terminating in a series of errors regarding problems with plugins. I can't run the app because I'm told that "Project 'hubbub' is missing required source folder: grails-app/utils". If I try to change 'app.grails.version' back to 2.3.7 I'm told that I need to configure a Grails installation of 2.3.7.
Am I doing something wrong here in trying to upgrade this Grails project? Or do I really have to install Grails 2.3.7 in order to get this to work?
(Sorry, I haven't posted the errors regarding plugin downloads but I can't seem to recreate them).
Thanks in advance!
Grails 2.4 is a big change over 2.3, mostly due to the use of the asset pipeline instead of resources.
Also simply changing the version in application.properties isn't enough, you also need to actually run the matching Grails framework.
See here for upgrading an app from 2.3 to 2.4: http://grails.github.io/grails-doc/2.4.x/guide/upgradingFrom23.html . From experience upgrading Grails apps from older versions must be done manually. One reason is that the upgrade command is obsolete and has been removed. Read the docs for breaking changes and address each change individually in the code. Upgrading patch levels are no problem (usually), but upgrading minor and major versions often are a lot of work.
Since you are learning, I would stick to 2.3.7 for your exercise (meaning that you must run 2.3.7, which you aren't doing). What you'll learn will remain valid. Do use 2.4.4 when building your own project from scratch.
If your project only missing grails-app/utils, try just to create it.
Take a look in your Project Properties -> Build Path. There are all the source folder defined. It can be helpful
I'm going to migrate an existing Grails 2.0 plugin to 2.4.
According to the migration guide the following steps were done:
run set-grails-version 2.4.4
update to latest plugin versions (hibernate4, tomcat, release and etc)
In in Intellij I've changed plugin SDK version on 2.4.4. Now module->dependencies looks like
It looks good but when I do grails compile, I have MultipleCompilationErrorsException in SvnDeployer class of release:3.0.1 plugin with "unable to resolve" message: unable to resolve class org.apache.commons.io.FilenameUtils(it's strange, commons.io is included into grails library)
On SDK of 2.0 everything is fine, but when I change SDK version to 2.4, project can not be compiled.
From my experience, Grails upgrades are not really smooth especially between feature releases.
I recommend starting with the usual
grails clean
grails refresh-dependencies
grails compile
After that check if you still get the same kind of errors, see whether or not excluding the svn plugin helps (if you're not using it).
I have been developing Grails apps for the past five years or so, and I have yet to find a simple consistent procedure for upgrading a project between Grails versions. Typically, I wind up starting the project from scratch, painstakingly copying code from the old project into a new project, bit by bit. Tweaking along the way to get the tests to pass.
There just seems to be too many balls to juggle, from Grails versions, to groovy versions, to STS/GGTS versions. They all seem to be backwardly incompatible.
I actually work with Grails for a few years too and never had to that this way.
What I do is:
Install the new version of Grails. I use GVM for that and I highly recommend it, but it depends on your platform of choice.
Read release notes for this version and apply them. It's very important step. It often includes some Grails "built-in" plugins upgrades and so on.
Bump up the version number using grails set-version.
Update IDE settings. I use IntelliJ and it runs smoothly most of the time.
Do grails clean/grails clean-all. Remove target.
Run all tests.
Do some "smoke tests" of the application. Test the most important happy paths.
I'm afraid you might already be doing it right, but if you don't own a copy of "Programming Grails" by Burt Beckwith I suggest you buy it. There's a chapter on "Upgrading Applications and Plugins" that might help you tune your approach.
You can upgrade grails version with 5 steps
Project -> Clean
application.properties -> Change app.grails.version = (New version)
Your project -> Properties -> Grails -> Change grails installation to new grails version.
Your project -> Grails tools -> Refresh Dependencies
Run your project
I think this may be help you
If I use GGTS I do the following:
Just in case install latest Groovy compiler (2.3.x) from the STS/GGTS update site (pick Groovy Eclipse). Then select the select.
Go to Preferences Groovy -> Grails and add newer version Grails runtime. Browse to it and then once added check-mark it.
Right-click on the Grails project you'd like to upgrade. Context menu pops up. Click on Grails Tools -> Grails Command Wizard...
Select the "upgrade" command from the list and click Finish. Follow the prompts in the Console view to upgrade the project.
Now set the appropriate for the version of Grails Groovy Compiler version via the preferences Groovy -> Compiler and restart Eclipse
Fix the compiler version for the Grails project if necessary after the restart.
Iām trying to upgrade Grails to version 2.2.0. I used gvm and installed Grails 2.2.0. After this I changed my project in GGTS to use Grails version 2.2.0 and Groovy version 2.0.0. But when I finally tried to run the project, I got the following error:
Error occurred during initialization of VMError opening zip file or JAR manifest
missing : null
agent library failed to init: instrument
What is the problem?
We had the same problem.
This is due to eclipse saving old run configuration for the previous grails version.
Just remove old launch configuration and retry.
To remove old launch configuration :
go to Run\RunConfiguration\Grails
select all nodes and remove them.
I had the same problem when I started using Grails 2.2.0 - The solution Ian mentioned works, here is the link to the issue and resolution that occurred in my project
Grails 2.2.0 error
Added on 1/15/2013 Other suggestions based on 2.2.0/ivy cache issues
I am running on windows, a couple of things to try.
Based on your error message seems like the issue might be related to the Ivy cached, I would suggest cleaning that out using the clean command.
I would also go ahead and delete the Icy cache folders on your machine at \ivy-cache(after backing it up just in case)
Read grails documentation at http://grails.org/doc/2.0.0/guide/gettingStarted.html, refer to section 2.3 regarding Ivy cache ā there might be issues running 2.x and 1.x grails projects side by side.
When install, I do not have to install groovy explicitly - I just install grails and that take care of the groovy code implicitly. Is that possible for you to do? To rule out dependency issues?
On my version of grails I have the groovy version showing up as 2.0.5 ā I assume you meant grails 2.2.0 ā can you ensure that you have a groovy version installed with is compatible with grails 2.2.0?
If possible try your code on a fresh device where grails has not been installed before. This is to rule out interference due to other existing issues
It's a known issue to do with the fact that the version of the springloaded reloading agent used by 2.2 (and 2.1.3) has a different name from that used by previous versions of Grails. There's a workaround in the bug report, or you can upgrade to a nightly build of GGTS which knows about the new name (as described in this bug report).
I am using GGTS 3.2 with Groovy compiler 2.1.1 on Windows XP.
Had imported a project from GGTS 3.1, upgraded compiler to 2.1.1 and got in mess, so
deleted the project and removed it from .grails cache, then re-created project from scratch. When it came to running the project I got the ivy error.
Removing the old launch configuration via Run->RunConfiguration...Grails fixed problem without switching to a night build of GGTS.
(BTW Deleting ivy-cache didn't help at all)