从Grails 1.3.6升级到2.1.1并且插件变得疯狂

时间:2012-11-20 23:36:36

标签: grails plugins groovy sts-springsourcetoolsuite

我使用的是Grails 1.3.6,在部署战争时遇到了上下文加载程序的问题。使用run-app工作得很好,但不是战争或战争。

在用完了想法后,我想也许将Grails更新为2.1.1会有所帮助,但我只为自己挖了一个更深的洞。

插件似乎随意进出。每次我退出STS并重新启动时,我都会获得一组不同的插件。安装它们不会安装它们,卸载它们不会通过管理器或命令行卸载它们。例如,我已经多次将jquery升级到1.8.3,但该项目仍然在插件下显示jquery 1.8.0。卸载插件后,它仍然会在插件下显示,但是当我再次卸载它时,它说它无法卸载它,因为它没有安装。

主要问题是敏捷。无论我做什么,我的应用程序都无法解析grails.plugins.nimble.core.ProfileBase或任何其他属于nimble插件的类。

因此使用nimble作为测试用例:

在我的项目资源管理器中:插件文件夹包含“灵活的0.4-SNAPSHOT”。

在application.properties中,有一行'plugins.nimble = 0.4-SNAPSHOT'。

在〜/ .grails / 2.1.1 / projects / MyProject / plugins中,存在一个带有源代码的nimble-0.4-SNAPSHOT文件夹。

在... / myProject / lib中有“nimble-0.4-SNAPSHOT.jar”和“nimble-0.4-SNAPSHOT.zip”,因为在不同的点上它正在寻找一个罐子或一个拉链。我只是将扩展名从.zip更改为.jar。

在Grails插件管理器中,nimble有一个绿色复选标记,显示已安装。

我的BuildConfig.groovy文件库存不变(虽然我尝试了很多不同的东西,我已经把它设置回原版),但是这里包含了很多内容:

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'
}

}

那么为什么我的应用程序不知道灵活?我尝试过“干净”,“刷新依赖”,“编译”,并在每种可能的组合中重新启动都无济于事。

我认为它与Grails 1.3.6升级到2.1.1没有完全或正确升级有关,但是什么?

谢谢。

1 个答案:

答案 0 :(得分:1)

从1.3.6变为2.1.1是一大步。我在列表中读到的内容现在可以思考:

  • 如果您的应用没有大量代码,最好创建一个新的新项目并复制您的来源。
  • BuildConfig.groovy是现在声明依赖关系的方式,使用它代替install-plugin(可能因为这个你的项目变得疯狂)

如果无法创建新的新项目并复制文件,请尝试小步骤(转到grails 1.3.7,然后是2.0.4,再转到2.1.1)