- build.gradle
apply plugin: 'java' apply plugin: 'spring-boot' repositories { maven { url "http://repo1.maven.org/maven2" } } dependencies { compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator' compile group: 'org.springframework.boot', name: 'spring-boot-starter-web' } buildscript { repositories { maven { url "http://repo1.maven.org/maven2" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.RELEASE") } } import org.apache.tools.ant.filters.* processResources { filter ReplaceTokens, tokens: [ "env": project.property("env") ] }
- src/main/resources/application.properties
spring.profiles.active=@env@
- result
You can find the changed value at properties file in builded jar file.
gradle build -Penv=test
Execution result
- build/resources/main/application.properties
spring.profiles.active=test
댓글 없음 :
댓글 쓰기