我在windows中使用grails 2.3.7。
我想开发一个grails-plugin schedulePlugin ,它可以与另一个grails插件一起使用 dbPlugin
我对schedulePlugin的构建配置
grails.project.dependency.resolver="ivy"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
legacyResolve true // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
mavenRepo 'http://repo.spring.io/milestone'
}
dependencies {
}
plugins {
runtime ':hibernate:3.6.10.10'
build(
":tomcat:7.0.50.1",
":release:2.2.1",
":rest-client-builder:1.0.3") {
export = false
}
//Own
compile ":grails-dbPlugin:2.0-A6"
}
我的dbPlugin构建配置
grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
mavenRepo "http://repo.grails.org/grails/libs-releases/" //Added this repo to resolve plugin dependencies for hibernate, joda, zk & quartz.
mavenRepo 'http://repo.spring.io/milestone'
}
dependencies {
}
plugins {
compile ":audit-logging:1.0.1"
compile ":database-migration:1.3.8"
runtime ":hibernate:3.6.10.10"
build(":release:3.0.1"
,":rest-client-builder:1.0.3"
,":tomcat:7.0.50.1") {
export = false
}
}
}
当我编译schedulePlugin时,它给我编译错误
| Error Compilation error: startup failed:
C:\projects\scheduler\target\work\plugins\dbPlugin-2.0-A6\grails-app\migrations\init-changelog.groovy: 1: unable to resolve class liquibase.statement.core.
@ line 1, column 1.
import liquibase.statement.core.InsertStatement
如果我将编译":数据库迁移:1.3.8" 添加到schedulePlugin的BuildConfig
,我可以解决错误但是它不应该自动继承dbPlugin的依赖关系。在这种情况下,某人可以协助如何解决依赖性
由于
答案 0 :(得分:1)
您在插件描述符文件中声明了正式的插件依赖项。例如,如果我的插件名为arkDashboard,那么描述符文件在我的插件项目的根目录中是ArkDashboardGrailsPlugin.groovy。以下是另一个名为“arkCore”的插件的依赖声明示例:
// Plugins that we are dependent on
def dependsOn = [
"arkCore": "1.2.2 > *"
]
描述符文件应该已经在您的插件项目中(由Grails创建),此部分已经被删除了。您只需要填写它。有关插件依赖性解析的详细信息,请参阅手册的“插件”部分。
这有点令人困惑,因为您可以使用BuildConfig.groovy文件中的显式规则“修复”依赖项,但您的直觉是正确的,如果可以,您应该将其保留为依赖项解析。它使代码不那么脆弱。
答案 1 :(得分:0)
看起来你遇到了和我一样的问题。在我看来,问题源于你的应用程序使用“常春藤”解析器,而插件使用“maven”解析器。
另请参阅:Using Grails plugins that use "maven" dependency resolver in a Grails app that uses "ivy"
答案 2 :(得分:0)
Geolocation插件在其BuildConfig.groovy
中具有运行时依赖性runtime 'com.javadocmd:simplelatlng:1.0.0'
您可以查看源代码here
现在只需将此添加到您应用的依赖项子句中即可。