public
Description: The Lift web framework for Scala
Home | Edit | New

1.0 -> 1.1 Possible code changes

Lift version upgrade from 1.0 to 1.1 probably causes few hiccups. Here’s a collection of most common and easily averted.

How to upgrade from 1.0 to 1.1

If you created your project from Maven archetype you ended up having a pom.xml at the root of your repository. Edit it manually, find XML like:


  <dependencies>
  ...
    <dependency>
      <groupId>net.liftweb</groupId>
      <artifactId>lift-core</artifactId>
      <version>1.0</version>
    </dependency>
  ...
  </dependencies>

and change version line to one you’d like to use, like:


      <version>1.1-M6</version>

You can check which versions are available by checking pluginRepositories:


  <pluginRepositories>
    <pluginRepository>
      <id>scala-tools.org</id>
      <name>Scala-Tools Maven2 Repository</name>
      <url>http://scala-tools.org/repo-releases</url>
    </pluginRepository>
  </pluginRepositories>

and browsing the url: http://scala-tools.org/repo-releases/net/liftweb/lift/.

If you are not 100% comfortable with bleeding edge use the milestones denoted by “-Mnumber”, for example 1.1-M6.

Scala Version

The version of Scala needed is 2.7.5


  <properties>
    <scala.version>2.7.5</scala.version>
  </properties>

Gotchas

DB query is a proxy without toString (Runtime error)

If you get an UndeclaredThrowableException runtime error you can easily fix it by changing your code in Boot.scala:


	//lift 1.0
	// DB.addLogFunc((query, time) => Log.info("Q: " + query + " T: " + time + " milliseconds"))
	
	//lift 1.1
	DB.addLogFunc((query, time) => Log.info("Q: " + query.statementEntries/* allEntries */ + " T: " + time + " milliseconds"))

Fixed!

Setting UTF8 encoding uses java HttpServletRequest (compilation problem)

Removing the extra method call makes incorrect type go away:


        // lift 1.0
        //   LiftRules.early.append(makeUtf8)
        //..
        //   private def makeUtf8(req: HttpServletRequest) {
        //     req.setCharacterEncoding("UTF-8")
        //  }

        // 1.1
	LiftRules.early.append{ _.setCharacterEncoding("UTF-8") }

Fixed! There are alternatives of course, like changing the type to required Scala type instead.

JsonCmd has moved (compilation problem)

New package is net.liftweb.util:


        // lift 1.0
        //   import _root_.net.liftweb.http.JsonCmd

        // 1.1
	import _root_.net.liftweb.util.JsonCmd
Last edited by chrisbnw, Mon Oct 19 20:09:03 -0700 2009
Home | Edit | New
Versions: