-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
166 lines (134 loc) · 4.98 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
println """\
Welcome to Gradle $gradle.gradleVersion - http://www.gradle.org
Gradle home is set to: $gradle.gradleHomeDir
Gradle user directory is set to: $gradle.gradleUserHomeDir
Base directory: $projectDir
Running script ${relativePath(buildFile)}
"""
group 'io.soluble.pssb'
version '1.0.0-SNAPSHOT' // Customize: set the version of the .war
def java_lang_version = '1.8' // set 1.7 if you like
ext {
pjb_version = '7.1.3'
// Customize, set the name of the jar and war file
// or send them through command line, i.e. `gradle -Pjar_name=JavaBridgeStandalone`
war_name = project.hasProperty('war_name') ? project.getProperty('war_name') : 'JavaBridgeTemplate'
jar_name = project.hasProperty('jar_name') ? project.getProperty('jar_name') : 'JavaBridgeStandalone'
}
buildscript {
ext {
//ext.spring_boot_version = '1.5.6.RELEASE'
ext.spring_boot_version = '2.0.4.RELEASE'
//ext.kotlin_version = '1.0.0' // Required for Kotlin integration
}
repositories {
mavenCentral()
}
dependencies {
classpath(
// "de.undercouch:gradle-download-task:3.1.2", // To download JavaBridge from github
"org.springframework.boot:spring-boot-gradle-plugin:${spring_boot_version}"
//"org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}" // Required for Kotlin integration
)
}
}
repositories {
mavenCentral()
//mavenLocal()
}
apply plugin: "java"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "war"
//apply plugin: "de.undercouch.download"
apply plugin: "org.springframework.boot"
// For Java 8
sourceCompatibility = java_lang_version
targetCompatibility = java_lang_version
configurations {
// If needed add some exclusions to reduce size
//all*.exclude group: 'org.codehaus.groovy', module: 'groovy'
//all*.exclude group: 'org.hibernate', module: 'hibernate-validator'
}
dependencies {
// Spring-boot stuffs
providedRuntime "org.springframework.boot:spring-boot-starter-tomcat:${spring_boot_version}"
//providedRuntime "org.springframework.boot:spring-boot-starter-undertow:${spring_boot_version}"
testCompile "org.springframework.boot:spring-boot-starter-test:${spring_boot_version}"
compile "org.springframework.boot:spring-boot-starter-web:${spring_boot_version}"
//compile("org.springframework.boot:spring-boot-starter-actuator:${spring_boot_version}")
compile ("org.springframework.boot:spring-boot-starter-thymeleaf:${spring_boot_version}") {
// exclude group: 'org.codehaus.groovy', module: 'groovy'
}
compile "org.springframework.boot:spring-boot-devtools:${spring_boot_version}" // Useful for dev (auto disabled on prod)
compile "com.google.code.gson:gson:2.8.0" // Deps for the ping address
// PHPJavaBridge
compile("io.soluble.pjb:php-java-bridge:${pjb_version}") {
// In sprint-boot, you can exclude javax.servlet and log4j
exclude group: 'javax.servlet', module: 'javax.servlet-api'
}
/** #######################################################
* Here you can add runtime dependencies to the project
* -------------------------------------------------------
* Those dependencies will be included available in the
* builded war file. Alternatively you may register deps
* through the 'init-script' method.
* (check 'init-scripts/README.md' folder for insights)
* #######################################################
*/
// example: mysql jdbc connector
/*runtime "mysql:mysql-connector-java:6.+"*/
}
war {
enabled = true
baseName = "${war_name}"
version = null
// optional
//from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}
bootRun {
//addResources = true
sourceResources sourceSets.main
// This sends all system properties to spring boot
// allowing to override application.yml settings//
// i.e. -> gradle bootRun -Dserver.port=8092
systemProperties = System.properties
}
configure(rootProject) {
task wrapper(type: Wrapper) {
description = 'Generates gradlew and gradlew.bat scripts'
gradleVersion = '4.10'
jarFile = "${project.projectDir}/gradle/wrapper/gradle-wrapper.jar"
}
}
task printProperties {
doLast {
println phpJavaBridgeVersion
}
}
task "forceTest" {
dependsOn "cleanTest", "test"
}
task "fullBuild" {
dependsOn "cleanTest", "test", "check", "build"
}
jar {
enabled = true
baseName = "${jar_name}"
version = null
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
manifest {
attributes(
'Class-Path': configurations.compile.collect { it.getName() }.join(' '),
'Main-Class': 'io.soluble.pssb.Application'
)
}
}
// Always repackage jar with the embedded tomcat
bootJar {
//classifier = 'boot'
baseName = "${jar_name}"
version = null
//withJarTask jar
}
defaultTasks 'war', 'jar', 'bootJar'