Upgrading a Maven Grails project from 1.1 to 1.1.1

Posted by Simon Wed, 24 Jun 2009 14:57:00 GMT

Grails 1.1.1 has been out for a while now. For those people who use grails directly the upgrade path is pretty simple (download, install, run "grails upgrade"). However for those of us who haven decided to build our projects via maven, the path seems to be much less clear.

There is a large mailing list thread or a more succinct comment that do cover what is needed to compile with 1.1.1 for most projects.

Here is that comment repeated in "svn diff" form for the project I've just upgraded:

Index: pom.xml
===================================================================
--- pom.xml (revision 95)
+++ pom.xml (working copy)
@@ -10,12 +10,12 @@
     <dependency>
       <groupId>org.grails</groupId>
       <artifactId>grails-crud</artifactId>
-      <version>1.1</version>
+      <version>1.1.1</version>
     </dependency>
     <dependency>
       <groupId>org.grails</groupId>
       <artifactId>grails-gorm</artifactId>
-      <version>1.1</version>
+      <version>1.1.1</version>
     </dependency>

     <!-- Grails defaults to OSCache for the second-level Hibernate cache. -->
@@ -58,6 +58,14 @@
        <type>jar</type>
        <scope>compile</scope>
     </dependency>
+
+    <!-- This is really a Grails 1.1.1 dependency, but it's not yet declared as such, so the work around is to include it here... -->
+    <dependency>
+      <groupId>org.tmatesoft.svnkit</groupId>
+      <artifactId>svnkit</artifactId>
+      <version>1.2.3.5521</version>
+      <scope>runtime</scope>
+    </dependency>
   </dependencies>

   <repositories>
@@ -99,7 +107,7 @@
       <plugin>
         <groupId>org.grails</groupId>
         <artifactId>grails-maven-plugin</artifactId>
-        <version>1.0</version>
+        <version>1.1-SNAPSHOT</version>
         <extensions>true</extensions>
         <executions>
           <execution>
Index: application.properties
===================================================================
--- application.properties  (revision 97)
+++ application.properties  (working copy)
@@ -9,4 +9,4 @@
 app.servlet.version=2.4
 plugins.hibernate=1.1.1
 app.name=webapp
-app.grails.version=1.1
+app.grails.version=1.1.1

Unfortunately that's not the whole storey though, as there are still several files that live within your project tree that are really part of Grails, and have changed between 1.1 and 1.1.1. So you have to put your project through the "grails upgrade" process to pick them up.

In theory running mvn grails:exec -Dcommand="upgrade" should do the job. But it doesn't. It managed about half of the job and then fails with an error:

Embedded error: java.lang.reflect.InvocationTargetException
/home/simon/build/cosalt/trunk/webapp/null/src/war not found.

So the solution seems to require a download of Grails 1.1.1...

$ cd /tmp
$ wget http://grails.org/download/file?mirror=99
$ tar -xzf grails-bin-1.1.1.tar.gz
$ cd <your project dir>
$ GRAILS_HOME=/tmp/grails-1.1.1 /tmp/grails-1.1.1/bin/grails upgrade

<confirm the upgrade>

That will add and replace a few files within your project tree. To add the new ones to svn:

$ svn add ivysettings.xml ivy.xml webapp-test.launch

One of the files that gets replaced is .classpath, but it gets replaced with lots of things that really aren't suitable for a maven project, so:

$ svn revert .classpath

Commit it all and you should be fully upgraded to 1.1.1. I do hope the Grails developers improve this process a little in the future!

While upgraded, that still wasn't the whole story for this particular project as it also uses the quartz plugin which disagrees with Grails 1.1.1 (whether you use maven or not). There is an easy work around available though, assuming you don't want to run quartz jobs in your integration tests. Here's the change I needed in svn diff format again:

Index: grails-app/conf/QuartzConfig.groovy
===================================================================
--- grails-app/conf/QuartzConfig.groovy (revision 95)
+++ grails-app/conf/QuartzConfig.groovy (working copy)
@@ -1,6 +1,11 @@
 //
 //
 quartz {
-    autoStartup = true
+    if (Environment.current != Environment.TEST) {
+        autoStartup = true
+    }
+    else {
+        autoStartup = false
+    }
     jdbcStore = false
 }

My project has gained a couple of warnings, but still passes it's tests and seems to work, in theory now with less bugs and 30% faster GSP rendering!

A quote

Posted by Simon Wed, 24 Jun 2009 14:32:00 GMT

I don't often repeat quotes for the sake of it, but I recently noticed this one in a signature on a mailing list and quite liked it:

"I contend we are both atheists, I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours." ...Stephen F Roberts

Apparently it's quite an old quote but it was new to me!

New SupaJam Unsigned Band Contest

Posted by Simon Mon, 20 Apr 2009 08:27:00 GMT

Last year SupaJam ran a contest to offer an unsigned band the chance to play at a huge music festival in Spain. They got over a thousand entries and one lucky band got flown out to Spain for a few days and got to play live at the festival.

This year the SupaJam site has been revamped and the new FIB contest has already been running for a couple of weeks. This year's contest looks set to be even bigger and better. They are already fast approaching the number of entries from last year and there are still a few weeks left to enter.

As I don't think many of the (2 or 3) people who read this blog actually play in a band...

Last year SEOSS was looking after the servers running the site and we had some limited involvement in keeping an eye on the development of the site. The actual development was outsourced to an Indian company who chose to base it on Typo3. By the time they had finished, there wasn't really very much of Typo3 actually visible, pretty much all of the site was custom extensions.

This year I have taken on a far more active role. SEOSS is still looking after the servers involved, however now I am personally managing the development (done by a small outsourced team and myself). This time around I have based the site on Social Web CMS, although there is still an awful lot of custom code involved.

We've still got a lot of exciting features in the development plan, plus a few rough edges to sort out. But the site is live and running well.

On that point, a slight aside - last year serving the homepage (which at that time was far simpler with less dynamic news content) to the local machine took approximately 1 second. This time around, the homepage takes just 0.1 seconds to serve to the local machine!

Both systems use PHP. The hardware, operating system and database have not changed. In theory the new system pays less attention to caching (we haven't optimised much yet) and it includes more dynamic content on the homepage. So my conclusion is not really a recommendation for SWCMS, but instead a warning to avoid Typo3!

Extracting a subdirectory from git as a new git repository

Posted by Simon Wed, 04 Feb 2009 12:20:00 GMT

Some time ago (about 2 years according to the file timestamps) I created a git repository to house all of my random personal files (letters, tax returns, random notes, etc).

Unfortunately at some point in the last two years I started to add in assorted other bits that really didn't belong, just because I needed somewhere to put them. To the extent that I now have at least two complete application code bases held in this repository!

Today I finally got around to extracting them out into their own repositories. Unfortunately taking just a subdirectory from within a git repository (complete with history) doesn't seem to be quite as easy as I'd hoped.

I decided that I wanted my final repository to be hosted by gitosis, which someone has expanded on a bit and is available in Debian.

Once gitosis was installed and I'd given myself write access to my new target repository, the process to extract the git subdirectory turned out to be...

$ cd big-old-repo
$ git branch to-extract
$ git filter-branch --subdirectory-filter path/to/extract to-extract
$ cd ..
$ mkdir tmp-new-repo
$ cd tmp-new-repo
$ git init
$ git pull ../big-old-repo to-extract
$ git remote add real-new-repo gitosis@my-server:real-new-repo.git
$ git push real-new-repo master
$ cd ..
$ git clone gitosis@my-server:real-new-repo.git

After all of that I now have a server hosted (and a local clone) repository that has it's top level at "path/to/extract" (and that's all it contains) from my old repository, complete with all history.

Obligatory snow post

Posted by Simon Tue, 03 Feb 2009 13:54:00 GMT

Two days ago, just after dark it started to snow. Pretty soon, merely a few hours later in fact, the road outside looked like this...

Snow

It's times like that when I'm very please I mostly work from home and hence have no concerns about about having to make a difficult journey through the snow in the morning.

However, it's times like that when I'm a little disappointed that I'll have no excuse to take a day off from work!

Although as it happened I didn't manage to get a lot of work done yesterday. Edward woke up and was promptly sick! This continued every time he had anything to eat throughout yesterday (thankfully he seems to be getting better today). Plus Sophie seems to have her first cold and would only settle when being held and walked around.

So not much work got done and there was no playing in the snow! :-(

Supposedly we were going to get another foot of snow overnight, but none arrived and what was on the ground is now melting quite rapidly. I guess the snowman will have to wait for another time.

One Of Each

Posted by Simon Thu, 22 Jan 2009 11:34:00 GMT

I am very pleased (and still rather scared) to announce the birth of Sophie Pither.

She was born early in the morning on 10th January and weighed in at 7lb 12oz.

So far, excluding the expected lack of sleep, everyone is doing well.

Sophie

The cost of preparation

Posted by Simon Sun, 28 Dec 2008 20:13:00 GMT

This year Liz has been extremely prepared with Christmas. She really wanted to keep the seasonal stress and last minute effort required to a minimum - no need to encourage an early birth after all.

So Liz started our Christmas shopping about three months ago! Apart from a couple of bits that actually couldn't be bought earlier, she had finished before December even started!

Now this sounds like a great plan. Get things done early, plenty of time to think about what to buy, with just as much time to spread the wrapping over too.

But this year there have been some slightly "different" economic conditions around. Almost everything and certainly most things gift like have been getting steadily cheaper over the last month or two.

So now several of our (well Liz's) carefully prepared gifts are actually worth as much as 50% less than when we bought them! So if you got a gift from us this year and feel a bit short changed, we're sorry but that's just the cost of being prepared!

Take from this what lessons you will.

(Personally I got very good value for money on the gifts I arranged, just a few days before they were required. Unfortunately I was up until 1am Christmas morning wrapping them!)

Older posts: 1 2 3 ... 11