【发布时间】:2015-03-30 11:18:50
【问题描述】:
我定义了一个名为 debug 的任务,它应该设置应用程序插件的 applicationDefaultJvmArgs,以便 spring-boot 停止并等待调试器。
我想将此任务与我定义的另一个名为 local 的任务结合使用,该任务设置一个 spring.profiles.active 变量。
apply plugin: 'spring-boot'
apply plugin: 'application'
apply plugin: 'org.flywaydb.flyway'
dependencies {
compile group: "org.apache.camel", name: "camel-netty4-http", version: camelVersion
compile group: "org.apache.camel", name: "camel-spring-boot", version: camelVersion
compile group: "org.springframework.boot", name: "spring-boot-starter", version: "1.2.1.RELEASE"
}
flyway {
url = 'jdbc:mysql://localhost:3306/foobar'
user = 'foo'
password = 'bar'
}
task local {
tasks.withType(org.springframework.boot.gradle.run.BootRunTask) {
systemProperty('spring.profiles.active', 'local')
}
}
task debug << {
project.ext {
applicationDefaultJvmArgs = [
"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
]
}
}
当我使用gradle local debug 调用 gradle 调试时,applicationDefaultJvmArgs 已设置,但当我调用 gralde local 时,它们也已设置?
我试过了
task debug << { ...
但这不会有什么不同。
【问题讨论】:
标签: gradle spring-boot