Grails upgrade path from 1.3.7 to 3.2.6 - grails

I have a Grails application currently running on Grails 1.3.7. I want to upgrade all the way to 3.2.6.
What would be the optimal path to do this? Should I just go straight to 3.2.6 and then try to get dependencies and compilation errors straight? Should I upgrade to 2.0 or 2.5.6 first, then go to 3.2.6? I feel like smaller steps might be easier, but then it seems like it would be harder to find the proper plugin versions to go along with the Grails version. I'm looking for the route that will require the least change and generate the least friction.

What would be the optimal path to do this? Should I just go straight
to 3.2.6 and then try to get dependencies and compilation errors
straight? Should I upgrade to 2.0 or 2.5.6 first, then go to 3.2.6?
At OCI we have done many many of these upgrades since we released 3.0 over 2 years ago. I advocate for skipping the 2.5.x step in almost all cases. Doing the 2.5.x upgrade will require some work that will be undone when you upgrade to 3.2.x and there is no real benefit to paying that additional price. The 2.5.x upgrade will be easier, but doesn't really buy you anything and you will have to take on the 3.x upgrade after that anyway, so just skip the intermediary step unless you have some specific compelling reason to include it (at this point, almost no apps have a valid justification for including that intermediary 2.5.x step).
I hope that helps.

I haven't gone from Grails 1.x to 3.x but have gone from 2.x to 3.x.
I would have thought you'd be better off going straight to 3 but don't expect it to be easy.
I would say make sure all the plugins you currently use have been ported to Grails 3 & if not make plans to either do it yourself or rewrite code to fit.
FWIW I documented my upgrade process here.

Remember there is no config.groovy in Grails 3. All your configuration you need to manage on application.yml. You need to manage your repositories and plugins on build.gradle
Study this document first http://docs.grails.org/3.0.x/guide/upgrading.html
Then, have a look on it Grails Version Update

Related

migrate from grails 3.0.4 to 3.0.6

What is the simplest way to migrate a Grails app developed in 3.0.4 to 3.0.6?
The grails documentation recommends to create a new app and migrate every component one by one. But there should be a simple way if we are migrating within version 3?
Any help much appreciated
I run a grails create-app to create a fresh install of the new version. I then copy the files from the new version over top of my older v3 version. It's then pretty simple using version control tools to check for changes that need to be merged. The following files will have some changes that need to be merged into my existing project files:
build.gradle
gradle.properties
To be safe I usually also copy over the following, though they are less likely to have changes:
gradle/
gradlew
gradlew.bat
grails-app/conf/application.yml
grails-app/conf/logback.groovy
grails-app/i18n/messages.properties
grails-app/init//Application.groovy
With version control it usually takes less than a few minutes to review and merge back any changes that need to be retained. I find the process fairly simple.
I think you refer to this documentation https://grails.github.io/grails-doc/latest/guide/upgrading.html which is really about grails 2.x to 3.0.x migration.
In the case you're already on 3.0.4 you can just look at the release note of the version to see what is new and if there's any impact. As you will see its a lot of bug fixes and the introduction of the new web profile to create REST specific applications.

grails backward compatibility

I recently get to know grails and start to using it, I know that grails is a great language and it is very helpful for rapid development, but I cant understand why grails dont have a good backward compatibility, I use grails 2.3.8 and grails 2.4 for my projects but many of sample codes in the internet are 2.2 or less, and it isn't time efficient to convert them to 2.3.8 or 2.4 because there are many changes from one version to another. And some times although I do any things right and every thing must work like it works with grails 2.1 or 2.2 but some things still remains.
Am I wrong? I skipped some things that make converting version so hard?
And above all this, what are the guaranties that projects I'm developing right now will be compatible with higher versions of grails that comes in the future?
Joshua Moore is right with his answer, but I do not see it as passimistic as he does.
The grails development team is brave enough to make changes which break with the past. I consider this as a great feature - Grails does not ride dead horses.
For me, most of the changes don't seem to bee too radical. Most of the time, I skip 2-3 version and then upgrade my apps to the current stable version in less than a day. This also helps me to get to know the new features.
If you don't know how to upgrade, the safest way is to use the grails upgrade command. Just increase you version number step by step and do an upgrade and re-run your test (yes, tests help you in your upgrade process :-). If tests fail, take a look at the great changelogs and the "What new in Grails x.y?" sections of the documentation.
Often it is also helpful to compare your old grails version app with a new and empty target version project with a good comparison tool like BeyondCompare. This way you easily spot changed configurations.
Hope that helps
Update: When you are new to "all those webconcepts" you should first decide on the platform you want to work on. If it is the java ecosystem, Grails is the best webframework on the market :-) Otherwise PHP, Rails, DJango etc. could also be a match.
So if you want to learn Grails (and with Grails all those webconcepts), I would suggest to start reading the Guide which will tell you how Grails works. If you need more examples, I can suggest the "The Definitive Guide to Grails 2" published by Apress. It covers basically the same content as the guide, but it does so by walking you through a process of building a sample application.
When it comes to the samples you find on the net... as soon as you get to know the framework better, you will probaply know ho to handle the examples - but there is no silver bullet...
Nothing guaranties that your projects will be compatible with future versions of Grails. In fact, from my own experience, they won't. Often things change, and sometimes radically too, as Grails matures into higher versions.
The same holds true of backwards compatibility as well.
All you need do is take a look at the introduction section of the Grails documentation to see how often things change significantly between versions. A lot of times these changes require significant refactoring of older projects to upgrade them. I still have several large projects running on the 1.3.x branch of Grails because we don't have the resources (time) to go through and upgrade them.
Often this upgrade process involves creating a new empty project then slowly moving the code from the old project into the new project, updating code to reflect newer means of doing the same thing and testing. It's not easy for projects where you have 100+ Domain classes, 1000+ GSPs, 50+ Services and several hundred thousand lines of tests.

grails 2.0 - installing resources plugin gives version 1.1.3, not version 1.1.6 [ ** Don't use install-plugin **]

Grails 2.0 projects currently come with resources plugin 1.1.5, which appears to have several dependency problems (e.g. see answer for this post). I'm using IntelliJ, and while I updated BuildConfig.groovy to
runtime ":resources 1.1.6"
which appears to cause IntelliJ to bring in new files, it doesn't update the plugins section (it still shows the old 1.1.5).
So then I did an uninstall-plugin-in resources, which got rid of the plugin in the Grails view. I then did install-plugin resources, and even though the resources plugin website shows it is at 1.1.6, I got a resources-1.1.3 plugin.
How is this possible? That's several versions back now. Additionally the website says it was updated 3 weeks ago to version 1.1.6.
Should one ever even use install-plugin? Can someone please tell me the preferred way to bring plugins into projects?
Thanks.
P.S. Not clear how to download this plugin.
The format for the dependency resolution DSL is group:name:version.
For the resources plugin it should be runtime ":resources:1.1.6"
The install-plugin command has been unofficially deprecated in favor of the dependency resolution DSL.
BUT, here's the first reference to install-plugin in the latest Grails 2.0 documentation:
"Grails supports Rails-style migrations via the Database Migration plugin which can be installed by running
grails install-plugin database-migration
IT WOULD APPEAR GRAILS 2.0 NEEDS TO HAVE AN OVERVIEW SECTION IN CHAPTER 3 -- JUST A FEW WORDS --, EXPLAINING THE DEPARTURE FROM USING INSTALL-PLUGIN, vs CREATING CONFUSION, AND NOT EVEN DOCUMENTING refresh-dependences anywhere in the main Grails 2.0 document if one searches for the term.
Otherwise I think developers like myself spend lots of time doing just the opposite of the main goal of what Grails is, wasting hours configuring things and getting them to run together, realizing the exact opposite of the Grail's goal: "the search is over", easy/fast application development.

Should I use Rails 3 for my application

I have been a user of Rails for a while and used version 2.3.4 recently.
Rails 3 Beta just came out recently and it seems have significant performance improvement especially with the merge with Merb.
I'm planning on building an application that will take 4-6 months. Should I use Rails 3 for it starting with beta? Knowing that it will be buggy until full release?
Performance is definitely an important requirement for my application.
You can help me if you can provide insight in the following questions:
1- Do you think Rails 3 will be out in 4-6 months?
2- Will it be easy to migrate code should I choose to go for Rails 2.3.5?
There are certain aspects to consider:
Does your application depend on 3rd party plugins/gems? If so than you should check if those are already Rails 3 compatible. You're probably gonna find libraries which are incompatible as yet but there is a big chance that these are gonna "get fixed" sooner or later.
Also, it really depends on what kind of application you are talking about. Personally I'm porting one of my 2.3.5 based sites to Rails 3 but only for preparing and learning purposes. Since Rails 3 is only public beta as yet, IT IS DEFINITELY NOT CONSIDERED TO BE PRODUCTION READY. You can download it, use it and play with it but that's pretty much it for now.
If you decide to upgrade one of your existing projects (which I'd encourage you to do) than have a look at Geoffrey Grosenbach's screencast which will guide you through the upgrading process.
There's also an official plugin which contains a handy script that you can use to find out which parts of your application need to be upgraded.
afaik there is no definite release date set yet. another point to consider is on how many rails plugins does your project depend on as i think most of them will need to be upgraded too ...
I think you should do it for version 2.3.5 but always think about Rails 3. Read release notes. For example use this plugin to escape html by default.
Try to use plugins that are ready for Rails 3. Check list here.
Use unobtrusive javascript.

Will upgrading gems break old Rails applications?

I have bunch of Rails apps running on Rails 1.x. I need to upgrade the gems so the question is, will these old apps still work after I upgrade gems?
Thank you.
The only way to be sure is to test, of course; that said, if you want to be sure the application works while you test, I believe that you can run
rake rails:freeze:gems
to copy the currently installed gems to the vendor folder inside your project. If, after testing, your project can use newer versions, run
rake rails:unfreeze
to return to the system installed versions of the gems.
It depends. If you're talking about upgrading to the latest gems that comprise Rails then if the applications use features that were long ago deprecated and subsequently removed, then they will break.
The only way to know for sure is to try it. Look out for deprecation warnings in the development log. Hopefully you have good test suites in place.
It's just like any other dependency. Look at the version number for each gem:
1.2.3
In this case, 1 is the major version. If this number has changed, then definitely do not upgrade. It will require work to use the new one.
2 is the minor version. You should be safe upgrading if only this number has changed, but be careful. Do a lot of smoke tests.
3 is a bug fix release. You can definitely upgrade if only this has changed. It's unlikely only this one has changed after so long, but if that's the case you're safe.
Unfortunately these are only guidelines, and many open-source projects among others do not follow them very well. So take the advice with a grain of salt.
If you are running with rails 1.x and you upgrade the rails gem, your application will break. Rails 2.x is very different.
Concerning other gems, they might break. Read the releases note, usually authors warn about backward compatibility.
If you don't want to upgrade, you could also freeze the gems.

Resources