我正在同时开发Grails(2.3.6)应用和插件。我刚刚完成了我的插件BuildConfig.groovy
的编写,看起来像是:
grails.project.class.dir="target/classes"
grails.project.dependency.resolver="maven"
grails.project.repos.default="myrepo"
grails.project.test.class.dir="target/test-classes"
grails {
project {
dependency {
resolution {
def gebVersion = "0.9.2"
def seleniumVersion = "2.40.0"
checksums = true
dependencies {
compile 'org.mongodb.morphia:morphia:0.107'
compile ('org.codehaus.groovy.modules.http-builder:http-builder:0.6') {
excludes 'groovy'
}
compile 'org.apache.commons:commons-lang3:3.3.2'
test "org.gebish:geb-spock:$gebVersion"
test "org.spockframework:spock-grails-support:0.7-groovy-2.0"
test "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
test "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
test "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
test "org.seleniumhq.selenium:selenium-ie-driver:$seleniumVersion"
}
inherits("global") {
}
legacyResolve = false
log "error"
plugins {
build ":release:3.0.1"
build ":tomcat:7.0.50.1"
compile "org.grails.plugins:gson:1.1.4"
compile ":rest-client-builder:1.0.3"
compile ":standalone:1.2.3"
compile ":cache-headers:1.0.4"
compile ':cache:1.1.1'
compile ":scaffolding:2.0.2"
compile ":yammer-metrics:3.0.1-2"
compile ":webflow:2.0.8.1"
compile ":ajaxflow:0.2.4"
runtime ":cached-resources:1.0"
runtime ":resources:1.2.7"
runtime ":hibernate:3.6.10.8" // or ":hibernate4:4.3.1.1"
runtime ":database-migration:1.3.8"
runtime ":jquery:1.11.0"
test(":geb:$gebVersion")
test(":spock:0.7") {
exclude "spock-grails-support"
}
}
repositories {
inherits true
grailsHome()
mavenLocal()
mavenRepo "http://myrepo01/myrepo/"
grailsPlugins()
grailsCentral()
mavenCentral()
}
}
}
fork = [
test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]
repos {
myrepo {
url = "http://myrepo01/myrepo"
type = "maven"
username = "repouser"
password = "12345"
}
}
source {
level = 1.7
}
target {
level = 1.7
}
test {
reports {
dir = "target/test-reports"
}
}
work {
dir = "target/work"
}
}
release {
scm {
enabled = false
}
}
servlet {
version = "3.0"
}
}
当我从导入此插件的应用程序运行grails run-app
时,我得到:
| Loading Grails 2.3.6
| Error WARNING: Inline plugins for [myplugin] cannot be read due to error: No
signature of method: groovy.util.ConfigSlurper$_parse_closure5.compile() is appl
icable for argument types: (java.lang.String) values: [org.mongodb.morphia:morph
ia:0.107]
Possible solutions: memoize() (Use --stacktrace to see the full trace)
Grails如何理解compile
关闭?!?我认为可能有某些正在继续使用Grails而不理解我设置的嵌套属性,但是从Grails configuration guide我可以告诉我正确使用嵌套属性语法。有什么想法吗?