我正在尝试在 build.gradle 中创建一个新任务,以使用名为“集成”的自定义环境运行“检查”。
我已经尝试了几件事,并且已经能够从我的自定义任务中运行检查任务,但是我找不到在 int 中设置环境的方法。
这是我现在在 build.gradle 中的任务。这些评论是针对我尝试过的事情,但都失败了,因为该属性不存在。我也尝试将任务设置为类型:GrailsTask,但没有运气
task integrationCheck(){
dependsOn "check"
//env = "integration"
//grailsEnv = "integration"
//tasks.check.env = "integration"
//check.env = "integration"
//project.property("grailsEnv")
}
编辑:根据@vinay-prajapati 的建议
试过这个:
task integrationCheck << {
systemProperty 'spring.profiles.active', 'integration'
}
它给出了这个错误:
Execution failed for task ':integrationCheck'.
> Could not find method systemProperty() for arguments [spring.profiles.active, integration] on root project 'my-project'