-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathbuild.gradle
More file actions
547 lines (442 loc) · 26.1 KB
/
build.gradle
File metadata and controls
547 lines (442 loc) · 26.1 KB
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
/*
File : build.gradle
Purpose : Build file for the JasperReportsIntegration project on
Date Author Comment
--------------------------------------------------
08.09.2020 D. Aust initial creation
14.09.2020 D. Aust fixed script to be able to run on Windows as well, added some debug output.
15.09.2020 D. Aust - changed war file name from JasperReportsInegration.war to jri.war
- excluded the servlet-api*.jar files from the downloaded jasper libraries
18.09.2020 D. Aust added missing jasperreports.properties file to WEB-INF/classes
03.10.2020 D. Aust fixed bug in generating eclipse project file,
now it is back to using "bin/default" as the default output dir, should be "build"
07.10.2020 D. Aust #52 - Uptake JasperReports Library 6.15.0
07.10.2020 D. Aust #55 - Barcodes produce classnotfound error
17.11.2020 D. Aust #66 - Uptake JasperReports Library 6.15.0
#63 - Optimization for developers - adding your own .jar files
switch to version 2.7.0
14.12.2021 D. Aust #87 - Security warning: New zero-day in the Log4j Java library
16.12.2021 D. Aust Remove all spring* references, library not used and Vulnerable Library - spring-core-5.1.4.RELEASE.jar
31.01.2022 D. Aust Ignore/remove older log4j2 libraries included in jasperreports-libraries
31.01.2022 D. Aust #93: Upgrading log4j 1.x to log4j 2.x (2.17.1)
01.02.2022 D. Aust #70: Upgrade Oracle JDBC libraries
08.02.2022 D. Aust #82: Unable to start JRI with tomcat 10 - buildWarTomcat10 task created
02.06.2022 D. Aust #102: Upgrade libraries to JasperReports 6.19.1
24.08.2022 D. Aust #115: Upgrade libraries to JasperReports 6.20.0
25.08.2022 D. Aust #116: JDK17 support, replace Groovy library with 3.0.12 (3.0.+)
22.11.2023 D. Aust #136: Upgrade libraries to JasperReports 6.20.6
18.09.2024 D. Aust #146: Upgrade libraries to JasperReports 7.0.0
16.10.2024 D. Aust #146: Upgrade libraries to JasperReports 7.0.1
*/
plugins {
id "war"
id "eclipse"
id "distribution"
id "org.gretty" version "3.0.9"
}
//for Ant filter
import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.internal.os.OperatingSystem
// import groovy helper functions
// println "$project.projectDir/src/groovy/tools.groovy"
// evaluate(new File("$project.projectDir/src/groovy/tools.groovy"))
//-----------------------------------------------------------------------------
//-- Configuration: typically the JRI version and version of jasperreports
//-- are changed
//-----------------------------------------------------------------------------
project.description = "JasperReportsIntegration - more details here: https://github.com/daust/JasperReportsIntegration"
project.version = '3.0.0'
sourceCompatibility = 1.8
targetCompatibility = 1.8
archivesBaseName = "jri"
// version of jasperreports to be used
def jasperreportsVersion ='7.0.1'
// Download Oracle JDBC drivers, must be the full version:
// https://www.oracle.com/database/technologies/appdev/jdbc-ucp-19c-downloads.html
// put files into folder lib/additional-war-libraries
// Download JasperReports files
// from: https://sourceforge.net/projects/jasperreports/files/jasperreports/
// or from https://github.com/TIBCOSoftware/jasperreports/releases
//-----------------------------------------------------------------------------
//-- Groovy helper functions
//-----------------------------------------------------------------------------
/* define repositories to look for maven modules */
repositories {
maven {url "https://plugins.gradle.org/m2/"}
gradlePluginPortal()
maven {url "https://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts"}
mavenCentral()
flatDir {dirs "lib/jasper-reports/$jasperreportsVersion"}
}
/* define specific maven dependencies */
dependencies {
// *** Only for compilation, NOT distributed
//compileOnly 'javax.servlet:javax.servlet-api:3.1.0'
// https://mvnrepository.com/artifact/org.springframework/spring-core
implementation group: 'org.springframework', name: 'spring-core', version: '5.+'
// https://mvnrepository.com/artifact/org.springframework/spring-beans
implementation group: 'org.springframework', name: 'spring-beans', version: '5.+'
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.+'
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-jcl
implementation group: 'org.apache.logging.log4j', name: 'log4j-jcl', version: '2.+'
// for the StringUtils was moved from lang3 to text
implementation 'org.apache.commons:commons-text:1.11.0'
// https://mvnrepository.com/artifact/commons-configuration/commons-configuration
implementation group: 'commons-configuration', name: 'commons-configuration', version: '1.+'
// https://mvnrepository.com/artifact/commons-codec/commons-codec
implementation group: 'commons-codec', name: 'commons-codec', version: '1.+'
// Get BOM file and choose Oracle JDBC driver (ojdbc8.jar) and Universal Connection Pool (ucp.jar)
// https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html
// check the current version
implementation(enforcedPlatform("com.oracle.database.jdbc:ojdbc-bom:21.4.0.0.1"))
implementation("com.oracle.database.jdbc:ojdbc8")
implementation("com.oracle.database.jdbc:ucp")
// Additional Jars for using Oracle Wallets
implementation("com.oracle.database.security:oraclepki")
implementation("com.oracle.database.security:osdt_core")
implementation("com.oracle.database.security:osdt_cert")
// Additional Jars for High Availability
// ons removed due to Timeout issue when connecting to cloud database #69
// https://github.com/daust/JasperReportsIntegration/issues/69
//implementation("com.oracle.database.ha:ons")
implementation("com.oracle.database.ha:simplefan")
// encrypting PDF files: https://github.com/daust/JasperReportsIntegration/issues/101
// https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on
implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.70'
// https://mvnrepository.com/artifact/xalan/serializer
// see bug: #55 - Barcodes produce classnotfounderror
implementation group: 'xalan', name: 'serializer', version: '2.7.1'
// https://mvnrepository.com/artifact/org.apache.xmlgraphics/xmlgraphics-commons
// see bug: #55 - Barcodes produce classnotfounderror
implementation group: 'org.apache.xmlgraphics', name: 'xmlgraphics-commons', version: '2.+'
// *** Only for TESTING
testCompileOnly 'junit:junit:4.12'
// joda time because auf
// https://mvnrepository.com/artifact/joda-time/joda-time
implementation group: 'joda-time', name: 'joda-time', version: '2.4'
// dependencies from jasperreports.proj
implementation fileTree(dir: "lib/jasper-reports/$jasperreportsVersion", include: ['*.jar'])
// dependencies from oracle jdbc
implementation fileTree(dir: "lib/additional-war-libraries", include: ['*'])
// https://mvnrepository.com/artifact/org.codehaus.groovy/groovy
// removed because version 4 will be included through jasperreports 7
// implementation 'org.codehaus.groovy:groovy:3.0.+'
// *** new import for JR 7 ***
// dependencies from jasperreports.proj
//compile fileTree(dir: "lib/jasper-reports/$jasperreportsVersion", include: ['*.jar'])
// dependencies from oracle jdbc
//compile fileTree(dir: "lib/additional-war-libraries", include: ['*'])
// https://mvnrepository.com/artifact/org.codehaus.groovy/groovy
//implementation 'org.codehaus.groovy:groovy:3.0.+'
//${jasperreportsVersion}
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports
implementation group: 'net.sf.jasperreports', name: 'jasperreports', version: "$jasperreportsVersion"
//implementation "net.sf.jasperreports:jasperreports:$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-functions
implementation group: 'net.sf.jasperreports', name: 'jasperreports-functions', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-xalan
// not using xml data sources
//implementation group: 'net.sf.jasperreports', name: 'jasperreports-xalan', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-ant
// implementation group: 'net.sf.jasperreports', name: 'jasperreports-ant', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-fonts
implementation group: 'net.sf.jasperreports', name: 'jasperreports-fonts', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-metadata
// no introspection/reflection of code is required
// implementation group: 'net.sf.jasperreports', name: 'jasperreports-metadata', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-data-adapters
// possibly required, will see
//implementation group: 'net.sf.jasperreports', name: 'jasperreports-data-adapters', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-pdf
implementation group: 'net.sf.jasperreports', name: 'jasperreports-pdf', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-velocity
// will include that because users might be using velocity syntax in their reports
implementation group: 'net.sf.jasperreports', name: 'jasperreports-velocity', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-charts
implementation group: 'net.sf.jasperreports', name: 'jasperreports-charts', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-json
// no support for JSON data sources required
implementation group: 'net.sf.jasperreports', name: 'jasperreports-json', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-excel-poi
implementation group: 'net.sf.jasperreports', name: 'jasperreports-excel-poi', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-chart-themes
implementation group: 'net.sf.jasperreports', name: 'jasperreports-chart-themes', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-jdt
// YES, I will certainly need support to compile the reports on-the-fly
implementation group: 'net.sf.jasperreports', name: 'jasperreports-jdt', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-annotation-processors
// yes, people might use annotations in the reports
implementation group: 'net.sf.jasperreports', name: 'jasperreports-annotation-processors', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-interactivity
// no, no JavaScript interactivity supported / required
implementation group: 'net.sf.jasperreports', name: 'jasperreports-interactivity', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-javascript
// no, no JavaScript interactivity supported / required
implementation group: 'net.sf.jasperreports', name: 'jasperreports-javascript', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-barbecue
implementation group: 'net.sf.jasperreports', name: 'jasperreports-barbecue', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-hibernate
// I don't use hibernate to access the data
// implementation group: 'net.sf.jasperreports', name: 'jasperreports-hibernate', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-spring
// nope, also no spring support needed
implementation group: 'net.sf.jasperreports', name: 'jasperreports-spring', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-chrome
implementation group: 'net.sf.jasperreports', name: 'jasperreports-chrome', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-google-maps
implementation group: 'net.sf.jasperreports', name: 'jasperreports-google-maps', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-data-adapters-http
// no, no data source over http required
implementation group: 'net.sf.jasperreports', name: 'jasperreports-data-adapters-http', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-fastexcel
implementation group: 'net.sf.jasperreports', name: 'jasperreports-fastexcel', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-ejbql
// nope, only JDBC data sources
// implementation group: 'net.sf.jasperreports', name: 'jasperreports-ejbql', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-chart-customizers
implementation group: 'net.sf.jasperreports', name: 'jasperreports-chart-customizers', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-barcode4j
implementation group: 'net.sf.jasperreports', name: 'jasperreports-barcode4j', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-servlets
// perhaps, perhaps not
// implementation group: 'net.sf.jasperreports', name: 'jasperreports-servlets', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-olap
// only jdbc data sources
// implementation group: 'net.sf.jasperreports', name: 'jasperreports-olap', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-groovy
implementation group: 'net.sf.jasperreports', name: 'jasperreports-groovy', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-jaxen
// no, I am not using XML data sources
// implementation group: 'net.sf.jasperreports', name: 'jasperreports-jaxen', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-servlets-j2ee
implementation group: 'net.sf.jasperreports', name: 'jasperreports-servlets-j2ee', version: "$jasperreportsVersion"
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.+'
}
gretty {
servletContainer = 'tomcat9' // can be changed to Tomcat, by default jetty9 is used
httpPort = 8090
//initParameter 'oc.jasper.config.home', "/tmp/jri"
contextPath = "/jri"
jvmArgs = [
'-Xms2048m', //Xms4096m
'-Xmx2048m', //Xmx4096m
'-XX:+UseConcMarkSweepGC',
'-server',
'-Djava.awt.headless=true'
]
}
//-----------------------------------------------------------------------------
//-- Groovy helper functions
//-----------------------------------------------------------------------------
// a wrapper closure around executing a string
// can take either a string or a list of strings (for arguments with spaces)
// prints all output, complains and halts on error
def runCommand = { strList ->
def proc = strList.execute()
proc.in.eachLine { line -> println line }
proc.out.close()
proc.waitFor()
print "[INFO] ( "
if(strList instanceof List) {
strList.each { print "${it} " }
} else {
print strList
}
println " )"
if (proc.exitValue()) {
println "gave the following error: "
println "[ERROR] ${proc.getErrorStream()}"
}
assert !proc.exitValue()
}
// run os command dependent on OS
private static Iterable<String> osAdaptiveCommand(String... commands) {
def newCommands = []
if (OperatingSystem.current().isWindows()) {
newCommands = ['cmd', '/c']
}
newCommands.addAll(commands)
return newCommands
}
/* Eclipse configurations
see: https://docs.gradle.org/current/dsl/org.gradle.plugins.ide.eclipse.model.EclipseClasspath.html */
eclipse {
classpath {
// remove duplicate libraries from the build path. There is a conflict in Eclipse when duplicate libraries are on the build path
// one in the jasper build lib directory (lib/jasper-reports/$jasperreportsVersion) and the local gradle cache:
//
file {
whenMerged { classpath ->
java.util.List wanted = new java.util.ArrayList()
def entries = classpath.getEntries()
// Sort the entries by their path (name)
def sortedEntries = entries.sort { it.path }
sortedEntries.each {
println " classpath: " + it.path
if ( //(it.path.contains('commons-lang-2.6.jar') && it.path.contains('.gradle/caches'))
//||
(it.path.contains('commons-logging-1.1.1.jar') && it.path.contains('.gradle/caches'))
) {
println('Removing library: ' + it.path + ' from eclipse classpath (duplicate)')
} else {
wanted.add(it)
}
}
//Collections.sort(wanted);
classpath.setEntries(wanted)
}
}
//customizing the classes output directory => use /build instead of /bin
/*defaultOutputDir = file('build')
file.whenMerged {
entries.each { entry ->
if (entry.kind == 'src' && entry.hasProperty('output')) {
entry.output = entry.output.replace('bin/', "build/")
}
}
}
*/
//default settings for downloading sources and Javadoc:
downloadSources = true
downloadJavadoc = false
}
project {
resourceFilter {
appliesTo = 'FOLDERS'
type = 'EXCLUDE_ALL'
matcher {
id = 'org.eclipse.ui.ide.multiFilter'
// to find out which arguments to use, configure the desired
// filter with Eclipse's UI and copy the arguments string over
arguments = '1.0-projectRelativePath-matches-false-false-src/main/dist'
}
}
resourceFilter {
appliesTo = 'FOLDERS'
type = 'EXCLUDE_ALL'
matcher {
id = 'org.eclipse.ui.ide.multiFilter'
// to find out which arguments to use, configure the desired
// filter with Eclipse's UI and copy the arguments string over
arguments = '1.0-projectRelativePath-matches-false-false-src/doc'
}
}
}
}
//-----------------------------------------------------------------------------
//-- task definitions for JasperReportsIntegration
//-----------------------------------------------------------------------------
war {
archiveFileName = "${archivesBaseName}-${project.version}-jasper-${jasperreportsVersion}.war"
// replaces tokens in the respective files only for the assembly of the .war file:
// @project.version@ =>
// @jasperreports.version@ =>
filesMatching(["*.html", "*.jsp"]) {
filter(ReplaceTokens, tokens: ['project.version': project.version, 'jasperreports.version': jasperreportsVersion])
}
//from 'src/rootContent' // adds a file-set to the root of the archive
// all occurences of @project.version@ will be replaced with the current project version
//from('src/doc/User-Documentation'){
// into 'doc'
//filter(ReplaceTokens, tokens: ['project.version': project.version, 'jasperreports.version': jasperreportsVersion])
//}
from('src/conf'){
include 'jasperreports.properties' into 'WEB-INF/classes'
}
doFirst{
manifest {
attributes( "Implementation-Title": project.name,
"Implementation-Version": project.version,
"Main-Class": "main.CommandLine",
//"Class-Path": "*.jar"
//"Class-Path": configurations.runtimeClasspath.collect { it.getName() }.join(' ') + " " + jar.outputs.files.collect { it.getName() }.join(' ')
//"Class-Path": war.classpath.collect { it.getName() }.join(' ') + " " + jar.outputs.files.collect { it.getName() }.join(' ')
)
}
}
//webInf { from 'src/additionalWebInf' } // adds a file-set to the WEB-INF dir.
//classpath fileTree('additionalLibs') // adds a file-set to the WEB-INF/lib dir.
//classpath configurations.moreLibs // adds a configuration to the WEB-INF/lib dir.
//classpath = ['src/...',]
//classpath = war.classpath.plus('src/conf/jasperreports.properties')
//webXml = file('src/conf/web.xml') // copies a file to WEB-INF/web.xml
//webInf { from 'src/conf/weblogic.xml' } // adds a file-set to the WEB-INF dir.
}
distZip.setArchiveFileName("${archivesBaseName}-${project.version}-jasper-${jasperreportsVersion}.zip")
distTar.setArchiveFileName("${archivesBaseName}-${project.version}-jasper-${jasperreportsVersion}.tar")
distributions {
main {
distributionBaseName = 'JasperReportsIntegration'
println 'getName:' + Distribution.getName()
contents {
from('src/apex'){into 'apex'}
from('src/sql'){into 'sql'}
from('src/shell-scripts'){//exclude '*ConfigDir.*'
//exclude 'deploy*'
into 'bin'}
from('src/conf/application.properties'){into 'conf'}
from('src/conf/log4j2.xml'){into 'conf'}
//from('src/doc/User-Documentation'){into 'doc' filter(ReplaceTokens, tokens: ['project.version': project.version, 'jasperreports.version': jasperreportsVersion])}
from('src/doc/Documentation.html'){ filter(ReplaceTokens, tokens: ['project.version': project.version, 'jasperreports.version': jasperreportsVersion])}
from('src/reports'){into 'reports'}
from (war.outputs){into 'webapp' rename(war.archiveName , "jri.war")}
from (configurations.runtimeClasspath){include "jasperreports-${jasperreportsVersion}.jar" into 'lib'}
from (jar.outputs){into 'lib'}
from ('lib/additional-commandline-libraries'){into 'lib'}
}
}
}
println "\n***********************************************"
println "Version: " + project.version
println "Source-Compatibility: " + project.sourceCompatibility
println "Project description: " + project.property("description")
println "jasperreports version: " + jasperreportsVersion
println "War file name: " + war.archiveName // this will pick up the modified name defined in war{}
println "local environment OC_JASPER_CONFIG_HOME=" + System.getenv( "OC_JASPER_CONFIG_HOME")
println "***********************************************\n\n"
//-----------------------------------------------------------------------------
//-- task definitions for developers
//-- setting up the developer environment and downloading new JRI libraries
//-- for a new JasperReports release
//-----------------------------------------------------------------------------
/* create a local environment with configuration files and reports and logs for developers
Please register path in gradle.properties file */
task jriCreateLocalEnvironment{
description = "create a local environment with configuration files and reports and logs. Please register path in gradle.properties file"
doLast{
println "Create local developer environment at jriLocalPath=" + jriLocalPath
file(jriLocalPath).mkdirs()
copy{from ('src/reports') into "$jriLocalPath/reports"}
copy{from ('src/main/dist/logs') into "$jriLocalPath/logs"}
copy{from ('src/conf/application.properties') into "$jriLocalPath/conf"}
copy{from ('src/conf/log4j2.xml') into "$jriLocalPath/conf"}
}
}
/* build a new war file that will work on Tomcat10 */
task buildWarTomcat10{
description = "build a new war file that will work on Tomcat10"
dependsOn build
//def cmd="$project.projectDir/src/build-support/jakartaee-migration-1.0.0/bin/migrate.sh $project.projectDir/build/distributions/${archivesBaseName}-${project.version}-jasper-${jasperreportsVersion}.zip $project.projectDir/build/distributions/${archivesBaseName}-${project.version}-jasper-${jasperreportsVersion}-tomcat10.zip -zipInMemory -exclude=\"*.jar\" -exclude=\"*jetty*.war\""
def cmd="$project.projectDir/src/build-support/jakartaee-migration-1.0.0/bin/migrate.sh $project.projectDir/build/libs/${archivesBaseName}-${project.version}-jasper-${jasperreportsVersion}.war $project.projectDir/build/distributions/${archivesBaseName}-${project.version}-jasper-${jasperreportsVersion}-tomcat10.war -zipInMemory -exclude=\"*.jar\" -exclude=\"*jetty*.war\""
doLast{
println "run command: " + cmd
runCommand.call( cmd )
}
}
/* build and deploy a version to the local Tomcat10 installation for testing */
task deployTomcat10{
description = "build a new war file that will work on Tomcat10"
//dependsOn buildWarTomcat10
def tomcatHome="/Users/daust/Downloads/KEEP/tomcat/apache-tomcat-10.0.16"
def cmd="cp $project.projectDir/build/distributions/${archivesBaseName}-${project.version}-jasper-${jasperreportsVersion}-tomcat10.war $tomcatHome/webapps/jri.war"
doLast{
println "shut down Tomcat10"
runCommand.call( "$tomcatHome/bin/shutdown.sh")
println "run command: " + cmd
runCommand.call( cmd )
println "start up Tomcat10"
runCommand.call( "$tomcatHome/bin/startup.sh")
}
}