-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathapi.gradle
55 lines (45 loc) · 1.25 KB
/
api.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
configurations {
// This configuration is used for referencing the API classes from the regular compile
apiClasses
}
// Define a "source set" referencing the API source code for the B2.
sourceSets {
api {
java {
srcDir "src/api/java"
}
resources {
srcDir "src/api/resources"
}
}
}
configurations.providedCompile.extendsFrom configurations.apiCompile
configurations.providedRuntime.extendsFrom configurations.apiRuntime
// Build and package the API source code
task apiJar( type: Jar, dependsOn: tasks.apiClasses ) {
from sourceSets.api.output
classifier = "api"
}
// Add the API JAR to the WAR
war {
from( apiJar ) {
into "WEB-INF/libext"
}
classpath = sourceSets.main.runtimeClasspath.minus( configurations.providedRuntime ).minus( configurations.apiClasses )
}
// Make sure that the API JAR is also uploaded to Maven if you deploy there.
artifacts {
archives apiJar
}
// Make sure that the compile job happens after the API job
project.compileJava.dependsOn project.apiClasses
// Add the API classes to the main compile classpath
dependencies {
apiClasses files( sourceSets.api.output.classesDir )
compile configurations.apiClasses
}
eclipse {
classpath {
minusConfigurations += configurations.apiClasses
}
}