java - Maven profiles equivalent of Gradle -
i'm trying achieve simple scenario in spring boot project build: including / excluding dependencies , packaging war or jar depending on environment.
so example, environment dev
include devtools , package jar, prod
package war etc.
i know not xml based configuration anymore , can write if statements in build.gradle there recommended way of achieving this?
can declare common dependencies , refer them in single file instead of creating multiple build files?
is there best practice changing build configuration based on build target environment?
ext { devdependencies = ['org.foo:dep1:1.0', 'org.foo:dep2:1.0'] proddependencies = ['org.foo:dep3:1.0', 'org.foo:dep4:1.0'] isprod = system.properties['env'] == 'prod' isdev = system.properties['env'] == 'dev' } apply plugin: 'java' dependencies { compile 'org.foo:common:1.0' if (isprod) { compile proddependencies } if (isdev) { compile devdependencies } } if (isdev) tasks.withtype(war).all { it.enabled = false }
Comments
Post a Comment