-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
136 lines (124 loc) · 4.37 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
plugins {
id 'java'
id 'maven-publish'
id 'signing'
}
group 'cn.mrcode.mycat'
version '0.1.0-SNAPSHOT'
//version '0.1.0'
sourceCompatibility = 1.8
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
[compileJava]*.options*.encoding = 'UTF-8'
}
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
[compileTestJava]*.options*.encoding = 'UTF-8'
}
// 测试用例没有写好,还不能自动测试
// 跳过所有文件的编译测试;不是跳过compileTestJava task 而是在执行该task的时候,跳过所有的测试文件
test {
exclude '**/*.class'
}
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/libs-snapshot' }
maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
maven { url "https://maven.repository.redhat.com/ga/" }
maven { url "http://maven.nuiton.org/nexus/content/groups/releases/" }
maven { url "https://repository.cloudera.com/artifactory/cloudera-repos/" }
}
dependencies {
compile 'org.slf4j:slf4j-api:1.7.25'
testCompileOnly 'junit:junit:4.12'
testCompileOnly 'org.apache.commons:commons-lang3:3.8.1'
testCompileOnly 'ch.qos.logback:logback-core:1.1.7'
testCompileOnly 'ch.qos.logback:logback-classic:1.1.7'
testCompileOnly 'org.apache.commons:commons-csv:1.6'
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allJava
}
// 生成 javadoc jar
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc.destinationDir
}
// javadoc 配置
javadoc {
description = "Generates project-level javadoc for use in -javadoc jar"
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.version = true
options.header = project.name
options.addStringOption('Xdoclint:none', '-quiet')
// suppress warnings due to cross-module @see and @link references;
// note that global 'api' task does display all warnings.
logging.captureStandardError LogLevel.INFO
logging.captureStandardOutput LogLevel.INFO // suppress "## warnings" message
options.encoding = "UTF-8" //编码一定要配置否则直接出错
options.charSet = 'UTF-8'
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.name
version "${version}"
from components.java
artifact sourcesJar
artifact javadocJar
// https://docs.gradle.org/current/dsl/org.gradle.api.publish.maven.MavenPublication.html
pom {
name = "fast-csv"
description = "load csv file for Mycat"
url = "https://github.com/zq99299/fast-csv"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "zq99299"
name = "mrcode"
email = "[email protected]"
}
}
scm {
connection = "scm:git:https://github.com/zq99299/fast-csv.git"
developerConnection = "scm:git:https://github.com/zq99299/fast-csv.git"
url = "https://github.com/zq99299/fast-csv"
}
}
}
}
repositories {
maven {
name 'sonatypeRepository'
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
credentials {
username = "${NEXUS_USERNAME}"
password = "${NEXUS_PASSWORD}"
}
}
maven {
name = 'sonatypeSnapshotRepository'
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
credentials {
username = "${NEXUS_USERNAME}"
password = "${NEXUS_PASSWORD}"
}
}
}
}
// 签名配置,注意这里的顺序,今天第一次知道 gradle 中的 task 等配置也是有顺序的
// 必须在 publishing 配置之后
signing {
sign publishing.publications.mavenJava
}
// 本页的打包配置参考官网文档 https://docs.gradle.org/current/userguide/publishing_overview.html