tags:

views:

295

answers:

1

I didn't think I made any tweaks to my machine configuration lately but all of the sudden, after I performed a 'grails clean', followed by 'grails war', I'm unable to build my project due to: "java.lang.UnsupportedClassVersionError".

JDK: 1.5.0_19 on MacOS 10.6
Grails: 1.1.1
Groovy: 1.6.5

Here's what I get when I execute 'grails war':

Welcome to Grails 1.1.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/local/grails-1.1.1

Base Directory: /Users/Robin/code/
Running script /usr/local/grails-1.1.1/scripts/War.groovy
Environment set to production
Warning, target causing name overwriting of name startLogging
     [copy] Copied 6 empty directories to 3 empty directories 
under /Users/robin/.grails/1.1.1/projects/wf/resources
    [mkdir] Created dir: /Users/Robin/code/web-app/plugins/ui-performance-1.2.1
     [copy] Copying 1 file to /Users/Robin/code/web-app/plugins/ui-performance-1.2.1
    [mkdir] Created dir: /Users/robin/.grails/1.1.1/projects/wf/classes
  [groovyc] Compiling 14 source files to /Users/robin/.grails/1.1.1/projects/wf/classes
  [groovyc] Compiling 262 source files to /Users/robin/.grails/1.1.1/projects/wf/classes
Compilation error: java.lang.UnsupportedClassVersionError: Bad version number in .class file

I have some jars that part java/part Groovy classes and they are compiled using Groovy 1.6.5.

Where do I start looking to figure out what's causing this problem? Prior to Grails 1.1, I don't recall having so many issues with the framework.

+1  A: 

AFAIK, Grails 1.1.1 does not depend on any JDK 6.x features and is compiled with 1.5 compatibility. I assume, that you have at least one plugin installed that is compiled with target JDK 6.x.

The most simple solution is installing a JDK 6.x and doing all Grails related stuff with this one. If this is not possible for some reason, you might use http://mindprod.com/products1.html#JARCHECK to identify the "bad guy", esp. in ~/.grails/1.1.1/projects/wf/plugins. Then checkout the "bad guy" plugin's sources using svn and compile it yourself with your JDK 1.5.

Stefan
Thank-you for pointing out this tool. It's absolutely fantastic! (I need to stay with JDK 1.5)
Robin Jamieson