forked from smart-doc-group/smart-doc-example-cn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
128 lines (116 loc) · 4 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
buildscript {
ext {
springBootVersion = '2.3.4.RELEASE'
smartDocVersion = '2.1.8'
}
repositories {
maven { url 'http://localhost:8081/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath('se.transmode.gradle:gradle-docker:1.2')
classpath("com.github.shalousun:smart-doc-gradle-plugin:${smartDocVersion}")
}
}
group 'com.power.doc'
version '1.0'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'docker'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'smart-doc'
smartdoc {
//
configFile = file("src/main/resources/smart-doc.json")
// exclude artifact
exclude 'org.springframework.boot:xx'
exclude 'org.springframework.boot:ddd'
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
repositories {
maven { url 'http://localhost:8081/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
mavenCentral()
}
configurations.compile {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
exclude group: 'org.springframework.boot', module: 'logback-classic'
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.13.1'
compile('org.springframework.boot:spring-boot-starter') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
compile('org.springframework.boot:spring-boot-starter-web') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
compile 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.4'
compile 'com.alibaba:druid-spring-boot-starter:1.1.23'
compile 'mysql:mysql-connector-java:8.0.15'
compile('org.springframework.boot:spring-boot-starter-log4j2')
compile 'com.lmax:disruptor:3.4.2'
compile('org.springframework.boot:spring-boot-starter-aop')
compile group: 'com.alibaba', name: 'fastjson', version: '1.2.74'
compile 'org.apache.commons:commons-lang3:3.9'
compile("org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}")
compile 'org.apache.commons:commons-text:1.8'
compile 'com.github.shalousun:common-util:2.0.4'
compileOnly 'org.projectlombok:lombok:1.18.0'
compile("com.github.shalousun:smart-doc-gradle-plugin:${smartDocVersion}")
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile 'com.github.shalousun:smart-doc:2.1.8'
}
task('copyConf', type: Copy) {
from "src/main/resources/"
into "build/package/${project.name}/config"
}
task('copyJar', type: Copy) {
from 'build/libs'
into "build/package/${project.name}/lib"
dependsOn('build')
}
task('copyBin', type: Copy) {
from 'src/main/scripts'
into "build/package/${project.name}/bin"
fileMode 0755
}
task('package', type: Tar) {
compression = Compression.GZIP
extension = 'tar.gz'
from "build/package"
mustRunAfter('clean')
dependsOn('clean', 'copyConf', 'copyJar', 'copyBin')
}
task buildDocker(type: Docker, dependsOn: build) {
applicationName = jar.baseName
dockerfile = file('src/main/docker/Dockerfile')
tagVersion = "1.0"
doFirst {
copy {
from jar
into stageDir
}
}
}
//upload jar to nexus
def nexusUrl = "http://localhost:8081/nexus/content/repositories/releases/"
if (version.endsWith("-SNAPSHOT")) {
nexusUrl = "http://localhost:8081/nexus/content/repositories/snapshots/"
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: nexusUrl) {
authentication(userName: "admin", password: "admin123")
}
pom.version = "$project.version"
pom.artifactId = "$project.name"
pom.groupId = "$project.group"
}
}
}