我在使用Grails 1.3.6,并且在部署战争时遇到了上下文加载器问题。使用run-app工作得很好,但不是跑步或战争。从Grails 1.3.6升级到2.1.1,插件变得疯狂了
在想法枯竭后,我想也许更新Grails到2.1.1会有所帮助,但我只为自己挖了一个更深的洞。
插件似乎是随机而来的。每次我退出STS并重新启动时,我会得到一组不同的插件。安装它们不会安装它们,卸载它们也不会通过管理器或命令行来卸载它们。例如,我已经将jquery升级到1.8.3几次,但该项目仍然显示插件下的jquery 1.8.0。卸载插件后,它仍然会显示在插件下,但是当我再次卸载它时,它说它不能卸载它,因为它没有安装。
主要问题一直与敏捷。无论我做什么,我的应用程序都无法解析grails.plugins.nimble.core.ProfileBase或任何其他属于灵活插件的类。
因此,使用灵活的测试案例:
在我的项目资源管理器:plugins文件夹中包含“敏捷0.4快照”。
在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”,因为它们在不同的位置寻找jar或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有关,但是什么?
谢谢。
仅使用BuildConfig管理插件是朝正确方向迈出的重要一步。谢谢!该项目不再有任何依赖性问题。 (FWIW,当我使用'build'时:敏捷:0.4-SNAPSHOT''没有任何变化,但是使用'compile':敏捷:0.4-SNAPSHOT''效果很好。不知道为什么。) –
插件仍然无法正常工作然而。战争建立没有任何抱怨,但部署时我得到“DEBUG支持.PluginAwareResourceBundleMessageSource - 无法解析任何资源插件i18n-2.1.1 java.io.FileNotFoundException:ServletContext资源[/WEB-INF/plugins/i18n-2.1。 1/grails-app/i18n /]无法解析为URL,因为它不存在“几个不同的插件,并且服务器无法启动。我将为此创建另一个问题。 –
@PhilTurner你可能想升级到最新的灵活,0.4快照和旧版本不再支持 –