A Gradle plugin to add Android style flavours to a Java project
plugins {
id "com.lazan.javaflavours" version "1.2"
}
javaFlavours {
flavour 'free'
flavour 'paid'
testJavaPathResolver = { String flavour -> "src/${flavour}-test/java" }
testResourcesPathResolver = { String flavour -> "src/${flavour}-test/resources" }
}
dependencies {
compile 'aaa:aaa:1.0'
freeCompile 'bbb:bbb:2.0'
freeTestCompile 'ccc:ccc:3.0'
paidRuntime 'ddd:ddd:4.0'
}
You find detailed installation instructions at https://plugins.gradle.org/plugin/com.lazan.javaflavours.
src/main/java
- Common java sourcessrc/main/resources
- Common resourcessrc/test/java
- Common testssrc/test/resources
- Common test resourcessrc/<flavour>/java
- Flavour specific java sources (can be configured)src/<flavour>/resources
- Flavour specific resources (can be configured)src/<flavour>Test/java
- Flavour specific tests (can be configured)src/<flavour>Test/resources
- Flavour specific test resources (can be configured)
compile<flavour>Java
compile<flavour>TestJava
<flavour>Classes
<flavour>Jar
<flavour>Test
<flavour>TestClasses
process<flavour>Resources
process<flavour>TestResources
<flavour>Compile
<flavour>CompileOnly
<flavour>CompileClasspath
<flavour>Runtime
<flavour>TestCompile
<flavour>TestCompileOnly
<flavour>TestCompileClasspath
<flavour>TestRuntime