<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tucker Pelletier</title>
    <description>The latest articles on DEV Community by Tucker Pelletier (@virtualdogbert).</description>
    <link>https://dev.to/virtualdogbert</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F377135%2F6c29e1ed-907e-44a9-8849-0157c5abab4d.png</url>
      <title>DEV Community: Tucker Pelletier</title>
      <link>https://dev.to/virtualdogbert</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/virtualdogbert"/>
    <language>en</language>
    <item>
      <title>Grails 3.3.10 to 4.0.2 Postmortem</title>
      <dc:creator>Tucker Pelletier</dc:creator>
      <pubDate>Tue, 12 May 2020 02:04:32 +0000</pubDate>
      <link>https://dev.to/virtualdogbert/grails-3-3-10-to-4-0-2-postmortem-5kj</link>
      <guid>https://dev.to/virtualdogbert/grails-3-3-10-to-4-0-2-postmortem-5kj</guid>
      <description>&lt;p&gt;The Grails 3 to 4 upgrade was nowhere near as daunting as upgrading from 2.5.x. However, I thought I would do a postmortem for the upgrade just the same. This is for a project that has about 80,000 lines of Groovy/Grails, and 40,000 lines of GSP, which is quickly becoming deprecated for Angular.&lt;/p&gt;

&lt;p&gt;Tasks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Custom password salt implementation finding temp workaround then replacing, with bcrypt.&lt;/li&gt;
&lt;li&gt;Removing a duplicate class wonder why this didn't cause issues before&lt;/li&gt;
&lt;li&gt;Removed a class that was just a script, which means it had a main method which caused errors&lt;/li&gt;
&lt;li&gt;Fixed unit test the fall back for the mixins didn't seem to work anymore&lt;/li&gt;
&lt;li&gt;Gorm/HQL had to replace all ? params with positional ?0,?1,..., etc.&lt;/li&gt;
&lt;li&gt;Had to add enabled = true to war task&lt;/li&gt;
&lt;li&gt;groovy.json.internal.LazyMap was being used with instanceof had to update to org.apache.groovy.json.internal.LazyMap&lt;/li&gt;
&lt;li&gt;Many instances where hibernate proxies were not being unwrapped. Fixed with GrailsHibernateUtil.unwrapIfProxy or fetch:'join' depending on circumstances&lt;/li&gt;
&lt;li&gt;DB migration plugin no longer has access to system properties so I had to add a fallback candidate to the config.&lt;/li&gt;
&lt;li&gt;Actuators and h2 console changed so I had to update the security around them&lt;/li&gt;
&lt;li&gt;Had to move where I defined the sourceSets for the resources for the db migrations&lt;/li&gt;
&lt;li&gt;Had to exclude old converters from grails-datastore-rest-client, which we should upgrade&lt;/li&gt;
&lt;li&gt;Had to fix spring security ldap:
&lt;a href="https://www.baeldung.com/spring-boot-security-autoconfiguration"&gt;https://www.baeldung.com/spring-boot-security-autoconfiguration&lt;/a&gt;
spring.autoconfigure.exclude=['org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration', 'org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration']&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Other resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/erichelgeson/grails-4-upgrade-notes-3cja"&gt;https://dev.to/erichelgeson/grails-4-upgrade-notes-3cja&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.grails.org/snapshot/guide/upgrading.html"&gt;https://docs.grails.org/snapshot/guide/upgrading.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://gorm.grails.org/7.0.x/hibernate/manual/index.html#upgradeNotes"&gt;http://gorm.grails.org/7.0.x/hibernate/manual/index.html#upgradeNotes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=i-zSKRsI2FA"&gt;https://www.youtube.com/watch?v=i-zSKRsI2FA&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/agorapulse-stories/how-to-benefit-from-grails-4-upgrade-e4f4aae4a9d"&gt;https://medium.com/agorapulse-stories/how-to-benefit-from-grails-4-upgrade-e4f4aae4a9d&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>grails</category>
      <category>groovy</category>
    </item>
    <item>
      <title>Grails 2.5.5 to Grails 3.3.10 Postmortem</title>
      <dc:creator>Tucker Pelletier</dc:creator>
      <pubDate>Tue, 12 May 2020 01:44:43 +0000</pubDate>
      <link>https://dev.to/virtualdogbert/grails-2-5-5-to-grails-3-3-10-postmortem-520a</link>
      <guid>https://dev.to/virtualdogbert/grails-2-5-5-to-grails-3-3-10-postmortem-520a</guid>
      <description>&lt;p&gt;Here's my postmortem of what I did in an upgrade from Grails 2.5.5 to Grails 3.3.10 I figured this may help someone... The app I was working on was fair-sized about 80,000 lines of Groogy/Grails and 40,000 lines of GSP, not including angular code, which is where the app is moving to. How hard a Grails 2 to 3 upgrade is a function of:&lt;br&gt;
How many bad practices your codebase had * the number of lines of code.&lt;/p&gt;

&lt;p&gt;Tasks/commits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Moved a lot of db writes in controllers to services with transactions&lt;/li&gt;
&lt;li&gt;Using the resource plugin had to upgrade to the Asset Pipeline&lt;/li&gt;
&lt;li&gt;Layouts, being used as templates&lt;/li&gt;
&lt;li&gt;Inline plugins that were deprecated, needed to be detangled and removed&lt;/li&gt;
&lt;li&gt;Moving a lot of code from web-app to src/main/webapp and fixing hardcoded links in js files&lt;/li&gt;
&lt;li&gt;Repackaged controllers, services, and domain objects from one or no package, into something more manageable.&lt;/li&gt;
&lt;li&gt;Porting JQgrid for older GSP code because the plugin wasn't ported to Grails 3
*Reworking the special password encoder that uses a hard-coded salt, one from the db, and one passed in from config. Later ditch for Bcrypt&lt;/li&gt;
&lt;li&gt;Porting a custom constraint to Grails 3&lt;/li&gt;
&lt;li&gt;Porting log4j to logback&lt;/li&gt;
&lt;li&gt;Refactoring a Util class that used GrailsDomainClass API to the Persistent API, and several classes that used it, Did changes several times, Was Like a game of wack a mole.&lt;/li&gt;
&lt;li&gt;Replacing ../  with / in gsp files&lt;/li&gt;
&lt;li&gt;Replacing a deprecated MD5Codec with encodeAsMD5
Ported AsyncEventPublisher to use Grails events&lt;/li&gt;
&lt;li&gt;Replacing CommonsMultiPartFile with CommonsMultiPartFile&lt;/li&gt;
&lt;li&gt;Fixing some static compilation issues&lt;/li&gt;
&lt;li&gt;Converting Filters to Interceptors&lt;/li&gt;
&lt;li&gt;Two versions on Angular&lt;/li&gt;
&lt;li&gt;Old GSPs using Jquery instead of Angular&lt;/li&gt;
&lt;li&gt;Fixing a class that was using an @Override that wasn't overriding anything...&lt;/li&gt;
&lt;li&gt;Fixing a bunch of custom validators that broke on upgrade&lt;/li&gt;
&lt;li&gt;Removing a lot of @Slf4j annotations that were unnecessary, and caused issues with some traits&lt;/li&gt;
&lt;li&gt;Fixed imports app, unit tests, and integration tests.&lt;/li&gt;
&lt;li&gt;Grails Mocks needed to be replaced&lt;/li&gt;
&lt;li&gt;GrailsUnitTestCase needed to be replaced.&lt;/li&gt;
&lt;li&gt;Validateable annotation had to be replaced with the Validateable trait&lt;/li&gt;
&lt;li&gt;Removing unused dependency that was causing build errors.&lt;/li&gt;
&lt;li&gt;Fixing a bunch of queries that were using string interpolation, but were also parameterized&lt;/li&gt;
&lt;li&gt;Fixed Spring security Roles missing the ROLE_ prefix, several times, all over the app&lt;/li&gt;
&lt;li&gt;Rolled back some of the Role prefix changes, because the role table was used for security roles, and roles in a different sense.&lt;/li&gt;
&lt;li&gt;Ported integration tests to use @Integration and @Rollback&lt;/li&gt;
&lt;li&gt;Added the external config plugin, to maintain the external configuration. And convert the YML, to Groovy config.&lt;/li&gt;
&lt;li&gt;JWT didn't have a secret key set in Grails 2 but needed it in Grails3&lt;/li&gt;
&lt;li&gt;Added @Transactional in some places that were missing it...&lt;/li&gt;
&lt;li&gt;Fixed integration tests, that were doing setup calls outside the setup methods&lt;/li&gt;
&lt;li&gt;Making integration helper classes that generate data in setup methods @Transactional&lt;/li&gt;
&lt;li&gt;Adding missing @Mock([&lt;/li&gt;
&lt;li&gt;Replacing constraints with constrainedProperties&lt;/li&gt;
&lt;li&gt;Eliminating with{} in Spock tests&lt;/li&gt;
&lt;li&gt;Removed autowire from Domain classes&lt;/li&gt;
&lt;li&gt;Added pathingJar = true for windows people&lt;/li&gt;
&lt;li&gt;Dealt with various Gradle commands not having access to System properties, which are needed for licensing validation.&lt;/li&gt;
&lt;li&gt;Fought with a test that was failing because of @Memoized
Sank a lot of time trying to get the test reports in the right place for the Jenkins jobs to pick them up&lt;/li&gt;
&lt;li&gt;A method that was annotated with @Transactional(readOnly=true) was doing a delete&lt;/li&gt;
&lt;li&gt;Fixed bouncy castle Gradle excludes&lt;/li&gt;
&lt;li&gt;Replaced PEMReader with PEMParser&lt;/li&gt;
&lt;li&gt;Fixed the way we got metadata for the app version&lt;/li&gt;
&lt;li&gt;Replaced uses of jdbcTemplacte to fix some integration tests&lt;/li&gt;
&lt;li&gt;Fix some HQL queries that were using id instead of the domain object&lt;/li&gt;
&lt;li&gt;Replaced some uses of a custom ApplicationContextHolder with Holders, which solved some issues&lt;/li&gt;
&lt;li&gt;Removed some deprecated logic dealing with releaseLocalThreadMemory() DomainClassGrailsPlugin.PROPERTY_INSTANCE_MAP.get().clear()&lt;/li&gt;
&lt;li&gt;Added Try catch to the interceptor and fixed the issue so the logs don't blow up.&lt;/li&gt;
&lt;li&gt;Moved a cascade from constraints to mapping&lt;/li&gt;
&lt;li&gt;Found several times that params don't have to be included on redirects and forwards, and if they are they can be duplicated into an array&lt;/li&gt;
&lt;li&gt;Fixed a GSP that could include properties or not... wrapped with a &amp;lt;g:if tag&lt;/li&gt;
&lt;li&gt;Updated Quartz jobs to work with new plugin swapping static with def&lt;/li&gt;
&lt;li&gt;Fixed command objects trait to ignore certain properties like constraintsMap, metaClass, class, constraints&lt;/li&gt;
&lt;li&gt;Fixed a test that was missing a controller context...&lt;/li&gt;
&lt;li&gt;Fixed several issues where associated properties of a domain class were not accessible in GSP files, so passed then as part of the model&lt;/li&gt;
&lt;li&gt;Started to have memory issues with the DB migration, This was cleared up by removing a lot of legacy changes from the changelog, and rebasing to a new "gold" image to start.&lt;/li&gt;
&lt;li&gt;All DB migration scripts in one folder(updated in the middle of a sprint right before a release) to be by version.&lt;/li&gt;
&lt;li&gt;Fixed a bunch of URLs, that didn't have the application context
*Command Object not binding body of delete, because it's not supposed to have one, used a util method that does the binding for me.&lt;/li&gt;
&lt;li&gt;Several places used the query parameter format, that didn't work the way it did before. used withFormat in several cases, some that I shouldn't have
*Refactored the places that I shouldn't have used withFormat to use command objects, because the params could come in as ajax post, or form post.&lt;/li&gt;
&lt;li&gt;Found a melody plugin issue between @Transactional and a Property of type class&lt;/li&gt;
&lt;li&gt;Swapped from failOnError:false to failOnError:true, and making a lot of code changes because of it. Don't do this, this is wrong.&lt;/li&gt;
&lt;li&gt;Fixed imports in GSP files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Things that held up or slowed down progress, things hopefully you can avoid:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Had to continue to merge changes coming from the Grails 2 branch that was actively being developed, and fix things as they broke.&lt;/li&gt;
&lt;li&gt;Moved new tests/integration test/web-app/src/groovy files to there new locations after merges&lt;/li&gt;
&lt;li&gt;Still had to work on pull request periodically&lt;/li&gt;
&lt;li&gt;Two versions on Angular, which was later reduced to one&lt;/li&gt;
&lt;li&gt;Got pulled back to work on the previous version of the app is several cases&lt;/li&gt;
&lt;li&gt;About 60+ security issues(XSS, SQL injection, CSRF) which took over the team for quite a while&lt;/li&gt;
&lt;li&gt;After which we stopped merging, between branches and had to cherry-pick between the three branches were are maintaining(two Grails 2, and the new Grails 3)&lt;/li&gt;
&lt;li&gt;Was left without QA for over a month.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://erichelgeson.github.io/blog/2016/04/17/upgrading-grails-3/"&gt;https://erichelgeson.github.io/blog/2016/04/17/upgrading-grails-3/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.grails.org/3.0.x/guide/upgrading.html"&gt;https://docs.grails.org/3.0.x/guide/upgrading.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://app.slack.com/client/T07LCCCSU/C07M0GTDE/thread/C07LCNWHG-1588321026.141200"&gt;https://app.slack.com/client/T07LCCCSU/C07M0GTDE/thread/C07LCNWHG-1588321026.141200&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.danvega.dev/blog/2017/06/16/migrating-grails-2-x-applications-grails-3-x/"&gt;https://www.danvega.dev/blog/2017/06/16/migrating-grails-2-x-applications-grails-3-x/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://philip.yurchuk.com/software/upgrading-to-grails-3/"&gt;http://philip.yurchuk.com/software/upgrading-to-grails-3/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://opensource.com/article/18/5/upgrading-grails-applications"&gt;https://opensource.com/article/18/5/upgrading-grails-applications&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://guides.grails.org/grails-quickcasts-developing-grails-3-applications-with-intellij-idea/guide/index.html"&gt;https://guides.grails.org/grails-quickcasts-developing-grails-3-applications-with-intellij-idea/guide/index.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This wasn't my first Grails 2 to 3 upgrade, I did another one that wasn't anywhere near as complicated, but the codebase was under 10,000 line of Groovy code. I'll publish another article for my Grails 4 postmortem, which is much shorter.&lt;/p&gt;

</description>
      <category>grails</category>
      <category>groovy</category>
    </item>
  </channel>
</rss>
