1
votes

I was using Grails 1.3.6 and was having an issue with the context loader when deploying a war. Worked fine with run-app, but not run-war or war.

After running out of ideas, I thought maybe updating Grails to 2.1.1 would help, but I have only dug a deeper hole for myself.

Plugins seem to be coming and going at random. Every time I quit STS and relaunch, I get a different set of plugins. Installing them doesn't install them and uninstalling them doesn't uninstall them, either through the manager or the command line. For example, I have upgraded jquery to 1.8.3 several times, but the project still shows jquery 1.8.0 under plugins. After uninstalling a plugin, it will still show under plugins, but when I uninstall it again, it says it can't uninstall it because it is not installed.

The main problem has been with nimble. No matter what I do my application cannot resolve grails.plugins.nimble.core.ProfileBase, or any other class that is a part of the nimble plugin.

So using nimble as a test case:

In my project explorer: the plugins folder includes "nimble 0.4-SNAPSHOT".

In application.properties, there is the line 'plugins.nimble=0.4-SNAPSHOT'.

In ~/.grails/2.1.1/projects/MyProject/plugins, there exists a nimble-0.4-SNAPSHOT folder with the source code.

In .../myProject/lib there are both "nimble-0.4-SNAPSHOT.jar" and "nimble-0.4-SNAPSHOT.zip" because at different points it was looking for a jar or a zip. I just changed the extension from .zip to .jar.

In the Grails Plugin Manager, nimble has a green checkmark showing it is installed.

My BuildConfig.groovy file is stock and unchanged (although I tried many different things, I have set it back to the original), but is included here for fun:

grails.servlet.version = "2.5" // Change depending on target container compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"

grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
    // specify dependency exclusions here; for example, uncomment this to disable ehcache:
    // excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve

repositories {
    inherits true // Whether to inherit repository definitions from plugins

    grailsPlugins()
    grailsHome()
    grailsCentral()

    mavenLocal()
    mavenCentral()

    // uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
    //mavenRepo "http://snapshots.repository.codehaus.org"
  // mavenRepo "http://repository.codehaus.org"
   // mavenRepo "http://download.java.net/maven/2/"
   // mavenRepo "http://repository.jboss.com/maven2/"
}
dependencies {
    // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.

    // runtime 'mysql:mysql-connector-java:5.1.20'
}

plugins {
    runtime ":hibernate:$grailsVersion"
    runtime ":jquery:1.8.0"
    runtime ":resources:1.1.6"
    //build ":nimble:0.4-SNAPSHOT"

    // Uncomment these (or add new ones) to enable additional resources capabilities
    //runtime ":zipped-resources:1.0"
    //runtime ":cached-resources:1.0"
    //runtime ":yui-minify-resources:0.1.4"

    build ":tomcat:$grailsVersion"

    runtime ":database-migration:1.1"

    compile ':cache:1.0.0'
}

}

So why is my application not aware of nimble? I have tried 'clean', 'refresh-dependencies', 'compile', and rebooting in every possible combination to no avail.

I think it must have something to do with not completely or correctly upgrading from Grails 1.3.6 to 2.1.1, but what?

Thank you.

1

1 Answers

1
votes

Changing from 1.3.6 to 2.1.1 is a big step. What I read in the list and can think now is:

  • If your app don't have a lot of code, it's better to create a new fresh project and copy your sources.
  • BuildConfig.groovy is the way of declaring dependencies now, use this instead of install-plugin (maybe because of this your project go crazy)

If creating a new fresh project and copying files is not a option, try small steps (go to grails 1.3.7, then 2.0.4 and then 2.1.1)