【问题标题】:Grails gradle: How to set System PropertyGrails gradle:如何设置系统属性
【发布时间】:2014-03-24 06:35:05
【问题描述】:

我可以知道为什么我在使用 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?谢谢。

【问题讨论】:

  • 你试过 System.setProperty('geb.env', 'sauce') 吗?

标签: grails gradle build.gradle


【解决方案1】:

错误信息是正确的:没有systemProperty()方法。

作为 Joshua Moore 的 cmets,这应该可行:

test {
  println "I'm in the test"
  System.setProperty 'geb.env', 'sauce'
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-08
    • 2014-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-03
    相关资源
    最近更新 更多