forked from borysn/spring-boot-angular2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
120 lines (99 loc) · 2.46 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 {
repositories {
mavenCentral()
}
dependencies {
// spring
classpath('org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE')
classpath('org.springframework:springloaded:1.2.6.RELEASE')
}
}
plugins {
id "com.moowork.node" version "0.12"
id "com.moowork.gulp" version "0.12"
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
repositories {
mavenCentral()
}
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')
}
}
idea {
module {
inheritOutputDirs = false
outputDir = file("${buildDir}/classes/main/")
}
}
jar {
baseName = 'spring-boot-angular2'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
configurations {
dev
}
dependencies {
// spring
compile('org.springframework.boot:spring-boot-starter-web')
// google gson
compile('com.google.code.gson:gson:2.6.2')
// spring dev tools
dev('org.springframework.boot:spring-boot-devtools')
// testing
testCompile('org.springframework.boot:spring-boot-starter-test')
}
def generatedWebResources = "${buildDir}/generated-web-resources"
sourceSets {
main {
output.dir(generatedWebResources, builtBy: 'gulp_build')
}
}
// configure gradle-node-plugin
node {
version = '6.3.0'
npmVersion = '3.10.5'
download = true
workDir = file("${project.projectDir}/src/main/web/node")
nodeModulesDir = file("${project.projectDir}/src/main/web")
}
// configure gradle-grunt-plugin
gulp {
workDir = file("${project.projectDir}/src/main/web");
colors = true
bufferOutput = false
}
// watch ts, sass, html files for changes and build
task gulpWatch(type: GulpTask) {
args = ['watch']
}
// gradle wrapper
task wrapper(type: Wrapper) {
gradleVersion = '2.14'
}
// clean node/node_modules/typings
task npmClean(type: Delete) {
final def webDir = "${rootDir}/src/main/web"
delete "${webDir}/node"
delete "${webDir}/node_modules"
delete "${webDir}/typings"
}
// run spring boot app
bootRun {
addResources = true
classpath = sourceSets.main.runtimeClasspath + configurations.dev
}
// ensure resources are processed before code is compiled
compileJava.dependsOn(processResources);
// build front-end before making jar
processResources.dependsOn(npmInstall)
npmInstall.finalizedBy(gulp_build)
// run npmClean before clean
clean.dependsOn(npmClean)