-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
174 lines (140 loc) · 5.03 KB
/
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
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
apply plugin: "base"
buildscript {
// 仓库配置
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.0'
}
}
// 一些简单的配置参数
// -----------------------------
// jar包版本依赖在gradle.properties中管理
ext {
gradleScriptDir = "${rootProject.projectDir}/gradle"
optional = true
}
// 所有项目共同的配置
// -----------------------
// 项目编译参数设置、依赖等等
configure(allprojects) {
apply plugin: "java"
apply from: "${gradleScriptDir}/ide.gradle"
group "org.fightteam.join"
configurations.all {
// 不缓存模块的改动
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
// 使所有的spring framework 库依赖版本统一
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.springframework') {
details.useVersion "$springVersion"
}
}
// 排除spring库中使用的common log
exclude group: "commons-logging"
exclude module: "slf4j-log4j12"
}
// 项目构建JDK版本
project.sourceCompatibility = 1.7
project.targetCompatibility = 1.7
// 编译参数
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:none", "-g"]
[compileJava, javadoc, compileTestJava]*.options*.encoding = 'UTF-8'
// 仓库
repositories {
mavenLocal()
mavenCentral()
maven { url "http://repo.spring.io/libs-snapshot" }
maven {
url 'http://repo.spring.io/milestone'
}
}
dependencies {
}
}
// 子项目共同的配置
// ----------------------
// 主要是javadoc的生成
configure(subprojects) { subproject ->
javadoc {
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.encoding = "UTF-8"
options.header = subproject.name
//options.overview = "${projectDir}/src/api/overview.html"
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
classifier = "javadoc"
from javadoc
}
artifacts {
archives sourcesJar
archives javadocJar
}
}
// 根项目配置
// ---------------------
// 主要是文档等的生成。
configure(rootProject) {
description = "Avalon Exporter"
// 根项目不生成jar
configurations.archives.artifacts.clear()
task api(type: Javadoc) {
group = "Documentation"
description = "Generates aggregated Javadoc API documentation."
title = "${rootProject.description} ${version} API"
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = rootProject.description
options.overview = "src/api/overview.html"
options.splitIndex = true
options.encoding = "UTF-8"
options.locale = "en_US"
options.linksOffline "http://docs.oracle.com/javase/6/docs/api/", "http://docs.oracle.com/javase/6/docs/api/"
options.linksOffline "http://docs.spring.io/spring/docs/4.0.0.RELEASE/javadoc-api/", "http://docs.spring.io/spring/docs/4.0.0.RELEASE/javadoc-api/"
options.linksOffline "http://docs.spring.io/spring-data/data-commons/docs/1.7.0.M1/api/", "http://docs.spring.io/spring-data/data-commons/docs/1.7.0.M1/api/"
options.linksOffline "http://docs.spring.io/spring-data/rest/docs/2.0.0.M1/api/", "http://docs.spring.io/spring-data/rest/docs/2.0.0.M1/api/"
options.linksOffline "http://docs.spring.io/spring-mobile/docs/1.1.0.RELEASE/api/", "http://docs.spring.io/spring-mobile/docs/1.1.0.RELEASE/api/"
options.linksOffline "http://docs.spring.io/spring-security/site/docs/3.2.0.RELEASE/apidocs/", "http://docs.spring.io/spring-security/site/docs/3.2.0.RELEASE/apidocs/"
options.linksOffline "http://docs.spring.io/spring-data/jpa/docs/1.5.0.M1/api/", "http://docs.spring.io/spring-data/jpa/docs/1.5.0.M1/api/"
source subprojects.collect { project ->
project.sourceSets.main.allJava
}
destinationDir = new File(buildDir, "api")
classpath = files(subprojects.collect { project ->
project.sourceSets.main.compileClasspath
})
maxMemory = "1024m"
}
task docsZip(type: Zip) {
group = "Distribution"
baseName = "join"
classifier = "docs"
description = "Builds -${classifier} archive containing api and reference."
from("src/dist") {
include "changelog.txt"
include "notice.txt"
}
from(api) {
into "api"
}
from("src/reference") {
into "reference"
}
}
artifacts {
archives docsZip
}
dependencies {
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.10'
}