Introduce DSL for profiles

In Maven you define profiles with it’s own dependencies, plugins etc. It would be very useful to have a specific DSL in Gradle to support this as well. Something like:

profiles {
    dev {
        dependencies {
            runtime('org.hibernate:hibernate:3.0.5')
        }
    }
    test {
        // some other deps
    }
}

and the run gradle with -P test option.

I looked at JIRA but did not see any ticket yet. Maybe good to add it?

1 Like

I am not sure whether we want to provide this functionality as part of Gradle core. It might make for a nice third-party plugin though for people coming from Maven. It’s fairly easy to solve the problem at the moment by having if/else block that pull in the relevant code as script plugins. The only thing missing would be the DSL.