Tuesday, February 25, 2014

Gradle - How to implement Maven's profile mechanism in Gradle

@/config/staging/resources

final String DEFAULT_PROFILE = 'staging'
allprojects {
    if (!project.hasProperty('profile') || !profile) {
        ext.profile = DEFAULT_PROFILE
    }
    sourceSets {
        main {
            resources {
                srcDir "config/${profile}/resources"
            }
        }
    }
}

@ Command
$ gradle zip -Pprofile=staging

No comments:

Post a Comment