-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
98 lines (82 loc) · 3.51 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
group 'com.cs.ssm'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'war'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
configurations {
mybatisGenerator
}
dependencies {
compile 'org.apache.tomcat:tomcat-servlet-api:8.0.24'
compile 'jstl:jstl:1.2'
compile 'org.springframework:spring-beans:4.1.7.RELEASE'
compile 'org.springframework:spring-web:4.1.7.RELEASE'
compile 'org.springframework:spring-webmvc:4.1.7.RELEASE'
compile 'org.springframework:spring-tx:4.1.7.RELEASE'
compile 'org.springframework:spring-context-support:4.1.7.RELEASE'
compile 'com.alibaba:druid:1.0.15'
compile 'org.aspectj:aspectjweaver:1.8.6'
compile 'mysql:mysql-connector-java:5.1.36'
compile 'org.mybatis:mybatis-spring:1.2.3'
compile 'org.mybatis:mybatis:3.3.0'
compile 'org.springframework:spring-jdbc:4.1.7.RELEASE'
compile 'junit:junit:4.12'
compile 'org.springframework:spring-test:4.0.5.RELEASE'
compile 'com.fasterxml.jackson.core:jackson-core:2.8.7'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.7'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.7'
compile "org.apache.shiro:shiro-core:1.2.2"
compile "org.apache.shiro:shiro-web:1.2.2"
compile 'org.apache.shiro:shiro-spring:1.2.2'
compile 'org.quartz-scheduler:quartz:2.2.1'
//compile files('libs/shardbatis-2.0.0B.jar')
compile 'com.github.pagehelper:pagehelper:4.1.0'
providedCompile 'javax.servlet:servlet-api:2.5'
mybatisGenerator 'org.mybatis.generator:mybatis-generator-core:1.3.5'
mybatisGenerator 'mysql:mysql-connector-java:5.1.40'
mybatisGenerator 'tk.mybatis:mapper:3.3.9'
}
def getDbProperties = {
def properties = new Properties()
file("src/main/resources/mybatis-generator/config.properties").withInputStream { inputStream ->
properties.load(inputStream)
}
properties
}
task mybatisGenerate << {
def properties = getDbProperties()
ant.properties['targetProject'] = projectDir.path
ant.properties['driverClass'] = properties.getProperty("jdbc.driverClassName")
ant.properties['connectionURL'] = properties.getProperty("jdbc.url")
ant.properties['userId'] = properties.getProperty("jdbc.username")
ant.properties['password'] = properties.getProperty("jdbc.password")
ant.properties['src_main_java'] = sourceSets.main.java.srcDirs[0].path
ant.properties['src_main_resources'] = sourceSets.main.resources.srcDirs[0].path
ant.properties['modelPackage'] = properties.getProperty("package.model")
ant.properties['mapperPackage'] = properties.getProperty("package.mapper")
ant.properties['sqlMapperPackage'] = properties.getProperty("package.xml")
ant.taskdef(
name: 'mbgenerator',
classname: 'org.mybatis.generator.ant.GeneratorAntTask',
classpath: configurations.mybatisGenerator.asPath
)
ant.mbgenerator(overwrite: true,
configfile: 'src/main/resources/mybatis-generator/generatorConfig.xml', verbose: true) {
propertyset {
propertyref(name: 'targetProject')
propertyref(name: 'userId')
propertyref(name: 'driverClass')
propertyref(name: 'connectionURL')
propertyref(name: 'password')
propertyref(name: 'src_main_java')
propertyref(name: 'src_main_resources')
propertyref(name: 'modelPackage')
propertyref(name: 'mapperPackage')
propertyref(name: 'sqlMapperPackage')
}
}
}