SlideShare ist ein Scribd-Unternehmen logo
1 von 71
Downloaden Sie, um offline zu lesen
UPGRADING FROM
GRAILS 1.X TO 2.X
STORIES AND LESSONS LEARNED
WillBuck,webdeveloper,virtuwell
Twitter(@wbucksoft) Github(willbuck) Email(wbucksoft@gmail.com)
A LITTLE ABOUT ME
(WillBuck)
OBLIGATORY COMPANY SHOUTOUT
MINNESOTA NATIVE
DISNEY WORLD JUNKIE
PRO(?)-AM TRAMPOLINE DODGEBALLER
GRAILS GUY
SHARING TODAY:
Case Study: 1.3.7 -> 2.1.0
A LITTLE ABOUT WHAT WE DID
8 In-House Plugins (some dependenton others)
3 Core Applications (one consumer-facing, two internal)
LOTS of testingoverhaul
CHIME IN!
Manyof you have done this, share your knowledge
BRIEF INTRO: WHY ARE
WE DOING THIS AGAIN?
GRAILS 2.X
(Wellduh)
What's newinGrails 2.0 and above
TESTABILITY
This would be aprimaryreason to upgrade.
Grails 2 introduced a*lot*of excellenttestingsupport, including...
In memoryGORM (makingunittestingcriteriaQueries
possible)
Better Console Output
Cleaner testreports
Annotation based mockingmakes code more straight-forward
(imho)
SUPPORT
Since much of the communityis movingforward with Grails 2, it
willbe easier to:
GetStackOverflow questions answered
Getanew feature in aplugin
Find talented developers familiar with your technology
Etc.
AND MORE!
Groovy1.8 support(or 2.0 in Grails 2.2+)
ORM improvements and more options (mongoDBfor
example)
Better defaultscaffolding(jQueryand HTML5)
Easier date parsing
Multiple DataSources Support
Etc etc etc (read the docs, yo!)
PREPARING TO UPGRADE:
BRING THE RIGHT TOOLS
DIRECTORY DIFF TOOL
Kaleidoscope -http://www.kaleidoscopeapp.com/
BeyondCompare -http://www.scootersoftware.com/
GVM
Lets you jump between versions with ease
gvm install grails [version]
http://gvmtool.net/
SOURCE CONTROL
Know how to hop around and make incrementalprogress!
Git, Mercurial, maybe SVN
UNIT TESTS
HOW TO BEGIN
START FRESH
SIDE BY SIDE
vs
IN-PLACE
Generates new-style metafiles w/proper dependencies
Testboth simultaneously
Commithistorywillbe cleaner -single commitof merge back!
grails upgrade
IS DEAD TO YOU!
GET THE TESTS PASSING FIRST
NOTE: THAT WILL TAKE AWHILE
FIRE IT UP!
MERGING BACK
THE CODE
WHAT 2 WATCH 4
COMMON ONES
Can largelybe found in grails documentation
Upgrading fromprevious versions of Grails
HSQL -> H2
Changes in DataSource.groovy
dataSource{
driverClassName="org.h2.Driver"
username="sa"
password=""
}
COMMAND OBJECT @VALIDATEABLE
@Validateable
classSearchCommand{
}
Note- seehttp://jira.grails.org/browse/GRAILS-9162
LOTS OF LITTLE THINGS
The redirect() method now uses the grails.serverURL config
setting
Public methods in controllers willnow be treated as actions. If
you don'twantthis, make them protected or private.
ConfigurationHolder.config-> grailsApplication.config
TESTING - A NEW WORLD ORDER
INHERITANCE -> ANNOTATIONS
//Grails1.xway
classmyControllerTestsextendsGrailsUnitTestCase{
}
INHERITANCE -> ANNOTATIONS
@TestFor(MyController)
@Mock([MyDomain])
classmyControllerTests{
voidtestSomething(){
//NoneedtomockDomain()anymore,justsaveaway!
MyDomaintestInstance=newMyDomain(property:'value').save()
defresult=controller.get()
assertresult==testInstance
}
}
OR CHECK OUT SOME GREAT PLUGINS!
//Grails2.xway
@TestFor(MyController)
@Build([MyDomain,MyOtherDomain])//Build-test-datapluginisgreat!
classmyControllerSpecextendsSpecification{
//BeSpock-tastic
void"testSomething"(){
given:"Adomaininstancetoretrieve"
MyDomaintestInstance=MyDomain.build(name:'Will.i.am')
when:"AcallisissuedtoController.get"
defresult=controller.get()
then:"Wegettheexpecteddomaininstance"
result==testInstance
}
}
COMING SOON!
Grails 2.3 -Spock byDefault!
NewinGrails 2.3
YOU MAY FIND SURPRISES...
Note: if you do have test-pollution...
Ted Naleid's Blog onFinding Test Pollution
TOUGHER / LESS DOCUMENTED GOTCHAS
PLUGIN DEPENDENCY DEFINITION
APPLICATION.PROPERTIES - >
BUILDCONFIG.GROOVY
APPLICATION.PROPERTIES (BEFORE)
#GrailsMetadatafile
#SunMar2515:53:36CDT2012
app.grails.version=1.3.7
app.name=patient-application
app.servlet.version=2.4
plugins.build-test-data=1.1.0
plugins.code-coverage=1.1.7
plugins.codenarc=0.5
plugins.database-migration=1.0
plugins.functional-test=1.2.7
plugins.greenmail=1.2.1
plugins.hibernate=1.3.7
plugins.jms=1.2
plugins.jmx=0.7
plugins.joda-time=1.2
plugins.jquery=1.4.1.1
plugins.mail=0.9
plugins.spock=0.5-groovy-1.7
plugins.spring-security-core=1.1
plugins.tomcat=1.3.7
plugins.ui-performance=1.2.2
BUILDCONFIG.GROOVY (AFTER)
plugins{
build":tomcat:$grailsVersion"
compile":mail:1.0"
compile":greenmail:1.3.2"
compile":build-test-data:2.0.3"
compile":codenarc:0.17"
compile(":functional-test:2.0.RC1")
compile":jms:1.2"
compile":jmx:0.7.2"
compile":joda-time:1.4"
compile":spring-security-core:1.2.7.3"
compile":ui-performance:1.2.2"
runtime":database-migration:1.1"
runtime":hibernate:$grailsVersion"
runtime":quartz:0.4.2"
test":spock:0.6"
}
APPLICATION.PROPERTIES (AFTER)
#GrailsMetadatafile
#MonMar1813:56:54CDT2013
app.grails.version=2.1.0
app.name=patient-application
app.servlet.version=2.4
RESOURCES PLUGIN
Bydefault, JS, CSS, images etc are now managed bythe
resources plugin.
<r:layoutResources>
<r:require modules="jquery-ui, blueprint">
This can mean a*lot*of restructuringto your front-end file
management.
STRUCTURED PROPERTIES
UNDERSCORES IN DOMAIN VARIABLES
//ingrails-app/domain/my-package
classSomeDomain{
//Alegitimateusecase
StringtelephoneNumber
StringtelephoneNumber_areaCode
StringtelephoneNumber_prefix
StringtelephoneNumber_lineNumber
//Accidentaloopsies,butwon'tkillthings
Stringname
Stringname_sourceId
//NOWwe'retalkingtrouble
DatedateOfBirth
StringdateOfBirth_sourceId
}
Discoveringthe shadowycorners...
TRY DIGGING DEEPER...
AND DEEPER.....
BUT EVENTUALLY...
in 1.3.7...
the same???
FIX IT AND LET IT GO
TAKEAWAY POINTS
TAKE YOUR TIME
Tryto keep new feature developmentto aminimum
Do aback-merge allatonce, rightbefore finishing. Communicate
with your team!
Take alook for existingdocs on how upgrade problems were
solved...
... butknow thatsome problems willbe unique to your codebase.
Don'tfear the source, love the source.
If allelse fails, ask the communityif you getstuck!
RESOURCES:
(FYI there was
no part2)
Grails Docs: Upgrading FromPrevious Versions
O`ReillyOpenFeedback Publishing: Programming Grails
Ted Naleids Blog - Upgrading toGrails 2 Unit Testing
Rob Fletchers Blog - Grails 2 UpgradePart 1
TechnipelagoBlog - Grails 1.3.7 to2.0.1 upgradeexperiences
SPECIAL THANKS TO:
Zan Thrash
Zach Legein
Zach Lendon
Colin Harrington
SenthilKumaran
Team @ virtuwell
and Mywife, Virginia
THANKS FOR LISTENING!
Anyquestions?
Givemefeedback! http://tinyurl.com/gr8wbuck13
Myinfo(again) Twitter(@wbucksoft) Github(willbuck) Email(wbucksoft@gmail.com)

Weitere ähnliche Inhalte

Was ist angesagt?

บทที่3
บทที่3บทที่3
บทที่3
Palm Unnop
 

Was ist angesagt? (16)

Full Stack Reactive with React and Spring WebFlux - SpringOne 2018
Full Stack Reactive with React and Spring WebFlux - SpringOne 2018Full Stack Reactive with React and Spring WebFlux - SpringOne 2018
Full Stack Reactive with React and Spring WebFlux - SpringOne 2018
 
PostgreSQL: Joining 1 million tables
PostgreSQL: Joining 1 million tablesPostgreSQL: Joining 1 million tables
PostgreSQL: Joining 1 million tables
 
Google apps script introduction
Google apps script introductionGoogle apps script introduction
Google apps script introduction
 
The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202
 
The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196
 
Database connectivity in python
Database connectivity in pythonDatabase connectivity in python
Database connectivity in python
 
Mongo db updatedocumentusecases
Mongo db updatedocumentusecasesMongo db updatedocumentusecases
Mongo db updatedocumentusecases
 
Sword fighting with Dagger GDG-NYC Jan 2016
 Sword fighting with Dagger GDG-NYC Jan 2016 Sword fighting with Dagger GDG-NYC Jan 2016
Sword fighting with Dagger GDG-NYC Jan 2016
 
GWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 PanicGWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 Panic
 
The Ring programming language version 1.5.1 book - Part 64 of 180
The Ring programming language version 1.5.1 book - Part 64 of 180The Ring programming language version 1.5.1 book - Part 64 of 180
The Ring programming language version 1.5.1 book - Part 64 of 180
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
COSCUP 2020 Google 技術 x 公共參與 x 開源 口罩地圖技術開源
COSCUP 2020 Google 技術 x 公共參與 x 開源 口罩地圖技術開源COSCUP 2020 Google 技術 x 公共參與 x 開源 口罩地圖技術開源
COSCUP 2020 Google 技術 x 公共參與 x 開源 口罩地圖技術開源
 
利用Init connect做mysql clients stat 用户审计
 利用Init connect做mysql clients stat 用户审计 利用Init connect做mysql clients stat 用户审计
利用Init connect做mysql clients stat 用户审计
 
The Ring programming language version 1.6 book - Part 70 of 189
The Ring programming language version 1.6 book - Part 70 of 189The Ring programming language version 1.6 book - Part 70 of 189
The Ring programming language version 1.6 book - Part 70 of 189
 
บทที่3
บทที่3บทที่3
บทที่3
 
G*なクラウド ~雲のかなたに~
G*なクラウド ~雲のかなたに~G*なクラウド ~雲のかなたに~
G*なクラウド ~雲のかなたに~
 

Ähnlich wie Upgrading Grails 1.x to 2

Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And Tricks
Mike Hugo
 
2009 03-26 grails-testing
2009 03-26 grails-testing2009 03-26 grails-testing
2009 03-26 grails-testing
geoffnettaglich
 
Groovygrailsnetbeans 12517452668498-phpapp03
Groovygrailsnetbeans 12517452668498-phpapp03Groovygrailsnetbeans 12517452668498-phpapp03
Groovygrailsnetbeans 12517452668498-phpapp03
Kevin Juma
 

Ähnlich wie Upgrading Grails 1.x to 2 (20)

Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013
 
Grails beginners workshop
Grails beginners workshopGrails beginners workshop
Grails beginners workshop
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And Tricks
 
Oracle GoldenGate
Oracle GoldenGateOracle GoldenGate
Oracle GoldenGate
 
Grails Advanced
Grails Advanced Grails Advanced
Grails Advanced
 
2009 03-26 grails-testing
2009 03-26 grails-testing2009 03-26 grails-testing
2009 03-26 grails-testing
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfig
 
Grails 4: Upgrade your Game!
Grails 4: Upgrade your Game!Grails 4: Upgrade your Game!
Grails 4: Upgrade your Game!
 
Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016
 
AtlasCamp 2012 - Testing JIRA plugins smarter with TestKit
AtlasCamp 2012 - Testing JIRA plugins smarter with TestKitAtlasCamp 2012 - Testing JIRA plugins smarter with TestKit
AtlasCamp 2012 - Testing JIRA plugins smarter with TestKit
 
Play Framework vs Grails Smackdown - JavaOne 2013
Play Framework vs Grails Smackdown - JavaOne 2013Play Framework vs Grails Smackdown - JavaOne 2013
Play Framework vs Grails Smackdown - JavaOne 2013
 
Gradle how to's
Gradle how to'sGradle how to's
Gradle how to's
 
Groovygrailsnetbeans 12517452668498-phpapp03
Groovygrailsnetbeans 12517452668498-phpapp03Groovygrailsnetbeans 12517452668498-phpapp03
Groovygrailsnetbeans 12517452668498-phpapp03
 
Config/BuildConfig
Config/BuildConfigConfig/BuildConfig
Config/BuildConfig
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfig
 
Os Davis
Os DavisOs Davis
Os Davis
 
Grails 3.0 Preview
Grails 3.0 PreviewGrails 3.0 Preview
Grails 3.0 Preview
 
Dropwizard and Friends
Dropwizard and FriendsDropwizard and Friends
Dropwizard and Friends
 
Droidcon Paris 2015
Droidcon Paris 2015Droidcon Paris 2015
Droidcon Paris 2015
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle Build
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Upgrading Grails 1.x to 2