forked from nonocast/todolist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
93 lines (78 loc) · 2.7 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
buildscript {
ext {
springBootVersion = '1.3.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath 'mysql:mysql-connector-java:5.1.16'
}
}
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
mainClassName='cn.nonocast.TodolistApplication'
sourceCompatibility = 1.8
targetCompatibility = 1.8
def getProjectVersion() {
// 获取application.properties中的project.verion
def properties = new Properties()
def propertiesFile = new File('src/main/resources/application.properties')
propertiesFile.withInputStream {
properties.load(it)
}
return properties['project.version']
}
version = getProjectVersion()
jar {
baseName = 'todoapp'
}
repositories {
mavenCentral()
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-web'
compile "org.springframework.boot:spring-boot-starter-security"
compile "org.springframework.boot:spring-boot-devtools"
compile "org.springframework.boot:spring-boot-starter-freemarker"
compile "org.springframework.boot:spring-boot-starter-data-jpa"
compile "org.springframework.boot:spring-boot-starter-redis"
compile "redis.clients:jedis:2.7.3"
compile "org.webjars:bootstrap:3.3.6"
compile "org.webjars:font-awesome:4.6.3"
compile "org.webjars:jquery:2.2.4"
compile "org.webjars:coffee-script:1.10.0"
compile "org.webjars:lodash:4.0.0"
compile "org.webjars:highcharts:4.2.5"
compile "org.webjars:react:15.2.1"
compile "org.webjars.npm:babel-core:5.8.19"
compile group: 'com.google.guava', name: 'guava', version: '19.0'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
compile group: 'mysql', name: 'mysql-connector-java'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310'
testCompile "org.springframework.boot:spring-boot-starter-test"
}
task webpack(type: Exec) {
standardOutput = new ByteArrayOutputStream()
commandLine "webpack"
doLast {
String output = standardOutput.toString()
if(output.readLines().any{line->line.trim().toLowerCase().startsWith("error")}) {
throw new GradleException("error in webpack: \n${output}")
}
}
}
jar.dependsOn webpack
task publish(dependsOn: build) << {
["cp", "build/libs/todoapp-${version}.jar", "../todoapp"].execute()
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
}
}