-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
120 lines (102 loc) · 3.76 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
buildscript {
ext {
springBootVersion = '1.5.2.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'war'
apply plugin: 'org.springframework.boot'
// 设置 Java 源码所在目录
/*sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'resources'
}
}
}*/
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8
[compileJava, compileTestJava, javadoc]*.options*.encoding = "UTF-8"
repositories {
mavenCentral()
}
dependencies {
//数据库连接驱动
runtime('mysql:mysql-connector-java')
//spring-boot
compile('org.springframework.boot:spring-boot:' + springBootVersion)
compile('org.springframework.boot:spring-boot-starter-data-jpa:' + springBootVersion)
compile('org.springframework.boot:spring-boot-starter-web:' + springBootVersion)
compile('org.springframework:spring-context-support:4.3.8.RELEASE')
//持久化框架
compile('com.alibaba:druid:1.0.31')
compile('javax.inject:javax.inject:1')
//dubbo
compile('com.alibaba:dubbo:2.5.3')
{
exclude group: 'org.springframework', module: 'spring'
exclude group: 'org.javassist'
}
compile('commons-io:commons-io:2.4')
//zookeeper支持
compile('org.apache.zookeeper:zookeeper:3.4.6')
compile('com.101tec:zkclient:0.8')
//hibernate-jpa支持
compile('org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final')
//quartz 定时任务
compile('org.quartz-scheduler:quartz:2.2.3')
//commons-lang3
compile('org.apache.commons:commons-lang3:3.4')
//spring-boot测试
testCompile('org.springframework.boot:spring-boot-starter-test:' + springBootVersion)
testCompile('org.springframework.boot:spring-boot-test:' + springBootVersion)
//排除log4j与log4j12中方法冲突
configurations.all {
resolutionStrategy {
final $slf4j_version = '1.7.22'
eachDependency {
details ->
if (details.requested.group == 'org.mockito' && details.requested.name == 'mockito-all')
details.useTarget(name: 'mockito-core', group: details.requested.group, version: details.requested.version)
else if (details.requested.group == 'commons-logging')
details.useTarget 'org.slf4j:jcl-over-slf4j:' + $slf4j_version
else if (details.requested.group == 'log4j')
details.useTarget 'org.slf4j:log4j-over-slf4j:' + $slf4j_version
else if (details.requested.group == 'org.jboss.netty' && details.requested.name == 'netty')
details.useTarget 'io.netty:netty:3.10.4.Final'
else if (details.requested.name == 'slf4j-log4j12')
details.useTarget 'ch.qos.logback:logback-classic:1.1.9'
else if (details.requested.group == 'org.slf4j')
details.useVersion $slf4j_version
}
}
}
//项目打包JAR--参考http://blog.csdn.net/asd1098626303/article/details/60868123 感谢
jar {
String desc = 'pack package'
configurations.runtime.each { desc = desc + "lib\\" + it.name }
manifest {
attributes 'Main-Class': 'com.study.SpringbootApplication'
attributes 'Class-Path': desc
}
}
task copyJar(type: Copy) {
from configurations.runtime
into('build/libs/lib')
}
task release(type: Copy, dependsOn: [build, copyJar]) {
}
war{
}
}