how to add multiple build configurations for my plugin?


Hello, I use ./gradlew clean build to build my plugin. I want there to be 2 diff configurations for build, i.e - prod(production) and dev(development) and I would want to execute some command like ./gradlew clean build prod to build for production. 

In some files, I want to write some code like 

If(build.isEquals("prod")) {

} else {




You can use properties like “dev” and “prod” passed to ./gradlew command like ./gradlew -Pdev … or  ./gradlew -Pprod …. In your build script, use:

if (project.hasProperty("dev")) {
  // do something dev specific
if (project.hasProperty("prod")) {
  // do something production specific

I didn't understand it. I want to have two separate logic in a Java file. So, from build.script file, i need to store the build configuration and access it wherever I want. how to achieve this?


I misunderstood that you want to achieve it in the plugin build script.

I suggest searching for information about Gradle resource filtering. See e.g.,


Please sign in to leave a comment.