forked from gilday/how-to-gradle-project-variations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
29 lines (27 loc) · 872 Bytes
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
subprojects {
apply plugin: 'java'
apply plugin: 'war'
group = 'com.johnathangilday'
version = '1.0'
repositories {
mavenCentral()
}
}
configure(subprojects.findAll { it.name != 'app' }) {
// extract variation encoded in the project name
def variation = project.name.substring(rootProject.name.length() + 1)
dependencies {
// use the variation to specify the servlet-api version
compile "javax.servlet:servlet-api:${variation}"
// include the app project where the web application servlet is defined
compile project(':app')
}
}
project('app') {
dependencies {
// the app project uses a version of the servlet-api
// compileOnly because we do not want to include this as a transitive dependency - the subprojects
// will bring their own version of the servlet-api
compileOnly 'javax.servlet:servlet-api:2.5'
}
}