I'm using Gradle spring-boot
plugin and I need to select a spring active profile for the test run.
How do I pass spring.profiles.active
system property to the bootRun
plugin's task?
What has already failed:
task bootRunLocal {
systemProperty "spring.profiles.active", "local"
System.setProperty("spring.profiles.active", "local")
tasks.bootRun.execute() // I suspect that this task is executed in a separate JVM
}
and some command line magic also fails:
./gradle -Dspring.profiles.active=local bootRun
Could someone kindly help me solve my troubles?
Update from the answers and comments:
I'm able to set the systemProperty and pass it to the spring container by doing :
run {
systemProperty "spring.profiles.active", "local"
}
However, when I do this, the local profile is being set for both bootRun
task and bootRunLocal
task. I need a way to set this property for bootRunLocal
task and call booRun
task from bootRunLocal
.
That might sound very simple, but I come with peace from the structured world of Maven.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…