我可以知道为什么在使用grails-gradle-plugin时我无法使用systemProperty方法设置系统属性?
我的build.gradle如下:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.grails:grails-gradle-plugin:2.0.0"
}
}
version "0.1"
group "example"
apply plugin: "grails"
repositories {
grails.central() //creates a maven repo for the Grails Central repository (Core libraries and plugins)
}
grails {
grailsVersion = '2.3.5'
groovyVersion = '2.1.9'
springLoadedVersion '1.1.3'
}
dependencies {
bootstrap "org.grails.plugins:tomcat:7.0.50" // No container is deployed by default, so add this
compile 'org.grails.plugins:resources:1.2' // Just an example of adding a Grails plugin
}
test {
println "I'm in the test"
//Could not find method systemProperty() for arguments [geb.env, sauce] on root project
systemProperty 'geb.env', 'sauce'//Fails
}
在测试任务中,运行$gradle grails-test
时出现以下错误:
无法在根项目中为参数[geb.env,sauce]找到方法systemProperty()..."
这是grails-gradle插件的问题,因为其他插件如" java"允许我使用setProperty?感谢。
答案 0 :(得分:0)
错误消息是正确的:没有systemProperty()方法。
正如Joshua Moore所说,这应该有效:
test {
println "I'm in the test"
System.setProperty 'geb.env', 'sauce'
}