forked from TreeInWinter/icloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
139 lines (115 loc) · 4.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
apply from: 'libraries.gradle'
group = 'com.travelzen'
version = '1.0'
allprojects {
buildDir = 'target'
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'idea'
apply plugin: 'maven'
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
repositories {
//maven { url 'http://172.31.16.127:8081/nexus/content/groups/public' }
maven { url 'http://localhost:8081/nexus/content/groups/public' }
maven { url 'https://maven.alfresco.com/nexus/content/groups/public' }
mavenCentral()
}
eclipse {
classpath {
downloadSources=true
}
}
configurations {
provided {
// todo : need to make sure these are non-exported
description = 'Non-exported compile-time dependencies.'
}
configurations {
all*.exclude group: 'commons-logging', module: 'commons-logging'
}
}
sourceSets.main.compileClasspath += configurations.provided
eclipse.classpath.plusConfigurations += configurations.provided
dependencies {
testCompile libraries.junit
}
sourceSets.main.resources {
if (project.hasProperty('profile')) {
srcDir 'src/main/resources-' + project.profile
srcDir 'src/test/resources-' + project.profile
}
}
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
eclipseProject.doLast {
if (!new File("$projectDir/src").exists() && !new File("$projectDir/gen-java").exists()) {
ant.delete dir: '.settings'
ant.delete file: '.project'
ant.delete file: '.classpath'
}
}
task 'create-dirs' << {
sourceSets*.java.srcDirs*.each { it.mkdirs() }
sourceSets*.resources.srcDirs*.each { it.mkdirs() }
}
task listJars << {
configurations.compile.each { File file -> println file.name }
}
task zip(type: Zip) {
from ('script') { into('bin') }
from ('src/main/resources') { into('conf') }
if (project.hasProperty('profile'))
from ('src/main/resources-' + project.profile) { into('conf') }
into('lib') {
from ('lib')
from (jar.outputs.files)
from (configurations.compile)
}
}
zip.doFirst {
if (new File("$projectDir/script").exists()) {
classpath = new File("$projectDir/script/.classpath")
if (!classpath.exists()) classpath.createNewFile()
cp = 'CLASSPATH='
for(file in new File("$projectDir/lib").listFiles()) cp += '../lib/' + file.name + ';'
for(file in configurations.compile) cp += '../lib/' + file.name + ';'
for(file in jar.outputs.files) cp += '../lib/' + file.name + ';'
classpath.text = cp.substring(0, cp.length() - 1)
}
}
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
// 编译groovy代码时采用 MacRoman
tasks.withType(GroovyCompile) {
groovyOptions.encoding = 'MacRoman'
}
// 编译JAVADOC文件时采用 UTF-8
tasks.withType(Javadoc) {
options.encoding = 'UTF-8'
}
// 编译JAVA文件时采用 UTF-8
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
uploadArchives {
repositories {
mavenDeployer {
repository(url: 'http://172.31.16.127:8081/nexus/content/repositories/releases') {
authentication(userName: "admin", password: "admin123")
}
snapshotRepository(url: 'http://172.31.16.127:8081/nexus/content/repositories/snapshots') {
authentication(userName: "admin", password: "admin123")
}
}
}
}
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
}