-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
269 lines (232 loc) · 8.59 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
/* spravny zapis pro gradle 5.0 */
wrapper {
gradleVersion = '4.8.1'
}
buildscript {
ext {
//springBootVersion = '1.5.7.RELEASE' // uz je 1.5.10.RELEASE // 2.0.0.RC2
springBootVersion = '2.0.4.RELEASE'
propDepsPluginVersion = '0.0.9.RELEASE'
//eclipseLinkJamgoPluginVersion = '0.2.2'
}
repositories {
mavenLocal ()
jcenter()
// propdeps plugin (enable+disable devtools if on development)
maven { url 'http://repo.spring.io/plugins-release' }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("io.spring.gradle:propdeps-plugin:${propDepsPluginVersion}")
//classpath("gradle.plugin.org.jamgo:eclipselink-plugin:${eclipseLinkJamgoPluginVersion}")
}
}
allprojects {
// Dependency Management which allows to import the Maven BOM dependencies
// https://github.com/spring-gradle-plugins/dependency-management-plugin
apply plugin: 'io.spring.dependency-management'
// IDE Integration
apply plugin: 'eclipse'
// Dev Tools: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-devtools
// https://github.com/spring-gradle-plugins/propdeps-plugin
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
apply plugin: 'propdeps-idea'
apply plugin: 'propdeps-eclipse'
// Classification -- Artifact GroupID and version number is shared across all submodules.
group = 'shop-allinone'
// ??? Lze pouzit?: group = rootProject.name
version = '0.0.1-SNAPSHOT'
// In this section you declare where to find the dependencies of your project
repositories {
mavenLocal ()
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
// Inklucujeme verze zavislosti, ktere pouziva spring-boot
// (nemusime je pak explicitne specifikovat)
// https://github.com/spring-gradle-plugins/dependency-management-plugin
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
}
}
}
/**
MULTI-MODULE BUILD
==================
https://docs.gradle.org/current/userguide/intro_multi_project_builds.html
https://docs.gradle.org/current/userguide/multi_project_builds.html
*/
subprojects {
// Apply the java plugin to add support for Java
apply plugin: 'java'
// All java subprojects run on JRE 1.8
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
// Add logging through log4j2
// https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-configure-log4j-for-logging
compile "org.springframework.boot:spring-boot-starter-log4j2"
}
configurations.all {
// Exclude default logback logging in order to use Log4j2:
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
//exclude group:"ch.qos.logback", module:"logback-core"
}
}
project(':shop-allinone-core')
{
//apply plugin: "org.jamgo.eclipselink-plugin"
ext {
projectNameLong = 'Backoffice - Product Definitions Core'
projectDescription = 'Library for accessing the products definition core functions (as well as persistence)'
}
// https://docs.gradle.org/current/userguide/java_library_plugin.html
//apply plugin: 'java-library'
//
// Source set configurations
//
configurations {
integrationCompile.extendsFrom testCompile
integrationRuntime.extendsFrom testRuntime
}
sourceSets {
test {
java {
srcDirs = [
'src/test/unit/java'
]
}
resources {
srcDirs = [
'src/test/unit/resources',
'src/test/unit/java' // java adresar duplicitne vlozim, aby byly videt soubory prilozene v tomto adresari
]
}
}
// Integration tests
integration {
java {
srcDirs = [
'src/test/integration/java',
]
}
resources {
srcDirs = [
'src/test/integration/resources'
]
}
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
}
dependencies {
// Spring boot
//compile "org.springframework.boot:spring-boot-starter-web"
// Tests
//testCompile "org.springframework.boot:spring-boot-starter-test"
// https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-sql.html
// Spring-boot DATA + JPA + JDBC + AOP support
compile ("org.springframework.boot:spring-boot-starter-data-jpa") {
// use eclipse-link, not hibernate
exclude group: "org.hibernate", module: "hibernate-core" // org.hibernate:hibernate-core:5.0.12.Final
exclude group: "org.hibernate", module: "hibernate-entitymanager" // org.hibernate:hibernate-entitymanager:5.0.12.Final
}
// JPA implementation: Eclipse Link
compile "org.eclipse.persistence:org.eclipse.persistence.jpa:2.7.3"
//
// Only for development
//
optional("org.springframework.boot:spring-boot-devtools")
// Concrete DB support
// INFO: Toto by nikdy neměla být závislost reálného projektu, ale nyní to použijme:
//runtime "org.apache.derby:derby"
// https://dzone.com/articles/using-the-h2-database-console-in-spring-boot-with
testRuntime("com.h2database:h2")
// Oracle JDBC for tests
testRuntime fileTree(dir: "$rootDir/libs", includes: ['com.oracle.jdbc-ojdbc6-11.2.0.4.jar'])
// Tests
testCompile "org.springframework.boot:spring-boot-starter-test"
}
/* HOW TO PERFORM EclipseLink - compile-time weaving?
- https://stackoverflow.com/questions/22997757/how-to-enable-eclipselinks-static-weaving-from-gradle
^^^^^^^^^^^^^
* /
task performJPAWeaving(type: JavaExec, dependsOn: "compileJava"){
inputs.dir compileJava.destinationDir
outputs.dir compileJava.destinationDir
main "org.eclipse.persistence.tools.weaving.jpa.StaticWeave"
args "-persistenceinfo",
"src/main/resources",
compileJava.destinationDir.getAbsolutePath(),
compileJava.destinationDir.getAbsolutePath()
classpath = configurations.compile
}
tasks.withType(Jar){
dependsOn "performJPAWeaving"
}
/ *
tasks.withType(Jar){
dependsOn "eclipselinkStaticWeave"
}
*/
//
// Tasks for running tests
//
task integration(type: Test, description: 'Runs the integration tests.', group: 'Verification') {
testClassesDirs = sourceSets.integration.output.classesDirs
classpath = sourceSets.integration.runtimeClasspath
}
}
project(':shop-allinone-webapp')
{
// Toto je spring-boot aplikace
apply plugin: 'org.springframework.boot'
ext {
projectNameLong = 'Shop Backoffice Application'
projectDescription = 'Used for configuration of products in our simple shop application.'
}
dependencies {
// ZAVISLOST NA VNITRNI KNIHOVNE _CORE_
compile project(':shop-allinone-core')
// Spring boot
compile("org.springframework.boot:spring-boot-starter-web") {
// exclude default logging
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
// Thymeleaf templating engine
compile "org.springframework.boot:spring-boot-starter-thymeleaf"
//compile "org.thymeleaf:thymeleaf:3.0.9.RELEASE"
// Thymeleaf layout dialect
compile "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:2.0.5"
// WebJars -- Bootstrap + JQuery
compile "org.webjars:bootstrap:3.3.7"
// https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-sql.html
// JPA support
compile ("org.springframework.boot:spring-boot-starter-data-jpa") {
// use eclipse-link, not hibernate
exclude group: "org.hibernate", module: "hibernate-core" // org.hibernate:hibernate-core:5.0.12.Final
exclude group: "org.hibernate", module: "hibernate-entitymanager" // org.hibernate:hibernate-entitymanager:5.0.12.Final
}
// JPA implementation: Eclipse Link
compile "org.eclipse.persistence:org.eclipse.persistence.jpa:2.7.3"
// JDBC support (already included in spring-boot-starter-data-jpa)
// ""You need a dependency on spring-jdbc for an embedded database to be auto-configured. In this example it’s pulled in transitively via spring-boot-starter-data-jpa.""
compile "org.springframework:spring-jdbc"
// Concrete DB support
// INFO: Toto by nikdy neměla být závislost reálného projektu, ale nyní to použijme:
//runtime "org.apache.derby:derby"
// https://dzone.com/articles/using-the-h2-database-console-in-spring-boot-with
compile "com.h2database:h2"
// Oracle JDBC Driver (has some licensing with it)
//compile fileTree(dir: 'libs', includes: ['/**/*.jar'])
compile fileTree(dir: "$rootDir/libs", includes: ['com.oracle.jdbc-ojdbc6-11.2.0.4.jar'])
// Tests
testCompile "org.springframework.boot:spring-boot-starter-test"
// Only for development
optional "org.springframework.boot:spring-boot-devtools"
}
}