title: Using Gradle to manage Java web app with flavors like Android
body: <p>I like the way Android Studio integrates with Gradle to let you create different build configurations (flavors). Effectively, you can have a class duplicated using the same package name but where the root package is located under a folder that corresponds to a build flavor. For example, if I have a Production flavor and a Development flavor I could have folders like this:</p>
  
  <p><strong>Production Flavor:</strong>
  app > src > production > java > com > mycompany > file.java</p>
  
  <p><strong>Development Flavor:</strong>
  app > src > development > java > com > mycompany > file.java</p>
  
  <p>Android Studio handles this nicely within the IDE and lets you easily select which flavor to build and will compile your code from those sources that correspond to the selected flavor.</p>
  
  <p>I'm using IntelliJ for doing web development but IntelliJ doesn't have the same kind of support for Gradle the way Android Studio does. I don't have a problem executing Gradle tasks manually if I have to.</p>
  
  <p>Has anyone used Gradle to manage web development in a way that lets you build variants (flavors)? Maybe there is a Gradle plugin specifically for this? If not, I suppose I could write my own.</p>