-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathbuild.gradle
83 lines (70 loc) · 3.12 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
// Optional: We configure the repositories to ease development and CI builds
buildscript {
repositories {
// Optional: Enables the maven local repository
// Example: ./gradlew build -PenableMavenLocalRepo
if ( project.hasProperty( 'enableMavenLocalRepo' ) ) {
// Useful for local development, it should be disabled otherwise
mavenLocal()
}
// Optional: Enables snapshots repository
// Example: ./gradlew build -PenableSonatypeOpenSourceSnapshotsRep
if ( project.hasProperty('enableSonatypeOpenSourceSnapshotsRep') ) {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
mavenCentral()
}
}
plugins {
// Optional: Hibernate Gradle plugin to enable bytecode enhancements
id "org.hibernate.orm" version "${hibernateOrmGradlePluginVersion}"
}
description = 'Hibernate Reactive Session Examples'
dependencies {
implementation project( ':hibernate-reactive-core' )
// Hibernate Validator (optional)
implementation 'org.hibernate.validator:hibernate-validator:8.0.2.Final'
runtimeOnly 'org.glassfish.expressly:expressly:5.0.0'
// JPA metamodel generation for criteria queries (optional)
annotationProcessor "org.hibernate.orm:hibernate-jpamodelgen:${hibernateOrmVersion}"
// database drivers for PostgreSQL and MySQL
runtimeOnly "io.vertx:vertx-pg-client:${vertxSqlClientVersion}"
runtimeOnly "io.vertx:vertx-mysql-client:${vertxSqlClientVersion}"
// logging (optional)
runtimeOnly "org.apache.logging.log4j:log4j-core:2.20.0"
// Allow authentication to PostgreSQL using SCRAM:
runtimeOnly 'com.ongres.scram:scram-client:3.1'
}
// Optional: enable the bytecode enhancements
hibernate { enhancement }
// Create tasks to run the different API available.
//
// They require the selected db ready to accept connections.
//
// Examples, in the session-example folder:
// gradle runExampleOnMySQLMain runExampleOnPostgreSQLMutinyMain
def mainJavaClasses = ['Main', 'MutinyMain']
def dbs = ['PostgreSQL', 'MySQL']
mainJavaClasses.each { String mainJavaClass ->
dbs.each { String db ->
tasks.register( "runExampleOn${db}${mainJavaClass}", JavaExec ) {
description = "Run ${mainJavaClass} on ${db}"
classpath = sourceSets.main.runtimeClasspath
mainClass = "org.hibernate.reactive.example.session.${mainJavaClass}"
// The persistence unit name defined in resources/META-INF/persistence.xml
args db.toLowerCase() + '-example'
}
}
}
tasks.register( "runAllExamplesOnPostgreSQL" ) {
dependsOn = mainJavaClasses.collect( [] as HashSet ) { mainClass -> "runExampleOnPostgreSQL${mainClass}" }
description = "Run ${mainJavaClasses} on PostgreSQL"
}
tasks.register( "runAllExamplesOnMySQL" ) {
dependsOn = mainJavaClasses.collect( [] as HashSet ) { mainClass -> "runExampleOnMySQL${mainClass}" }
description = "Run ${mainJavaClasses} on MySQL"
}
tasks.register( "runAllExamples" ) {
dependsOn = ["runAllExamplesOnPostgreSQL", "runAllExamplesOnMySQL"]
description = "Run all examples on ${dbs}"
}