Skip to content

Commit cbf6d89

Browse files
committed
[#2333] Print the resolved Hibernate ORM and Vert.x version
This is important to check what verison is actually resolved on the `wip/*` branches, where we test the snapshots, because we use a versions range.
1 parent 05315c7 commit cbf6d89

File tree

3 files changed

+97
-0
lines changed

3 files changed

+97
-0
lines changed

examples/native-sql-example/build.gradle

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,36 @@ tasks.register( "runAllExamples" ) {
7575
dependsOn = ["runAllExamplesOnPostgreSQL"]
7676
description = "Run all examples on ${dbs}"
7777
}
78+
79+
// Optional: Task to print the resolved versions of Hibernate ORM and Vert.x
80+
tasks.register( "printResolvedVersions" ) {
81+
description = "Print the resolved hibernate-orm-core and vert.x versions"
82+
doLast {
83+
def hibernateCoreVersion = "n/a"
84+
def vertxVersion = "n/a"
85+
86+
// Resolve Hibernate Core and Vert.x versions from compile classpath
87+
configurations.compileClasspath.resolvedConfiguration.resolvedArtifacts.each { artifact ->
88+
if (artifact.moduleVersion.id.name == 'hibernate-core') {
89+
hibernateCoreVersion = artifact.moduleVersion.id.version
90+
}
91+
if (artifact.moduleVersion.id.group == 'io.vertx' && artifact.moduleVersion.id.name == 'vertx-sql-client') {
92+
vertxVersion = artifact.moduleVersion.id.version
93+
}
94+
}
95+
96+
// Print the resolved versions
97+
println "Resolved Hibernate ORM Core Version: ${hibernateCoreVersion}"
98+
println "Resolved Vert.x SQL client Version: ${vertxVersion}"
99+
}
100+
}
101+
102+
// Make the version printing task run before tests and JavaExec tasks
103+
tasks.withType( Test ).configureEach {
104+
dependsOn printResolvedVersions
105+
}
106+
107+
tasks.withType( JavaExec ).configureEach {
108+
dependsOn printResolvedVersions
109+
}
110+

examples/session-example/build.gradle

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,35 @@ tasks.register( "runAllExamples" ) {
8181
dependsOn = ["runAllExamplesOnPostgreSQL", "runAllExamplesOnMySQL"]
8282
description = "Run all examples on ${dbs}"
8383
}
84+
85+
// Optional: Task to print the resolved versions of Hibernate ORM and Vert.x
86+
tasks.register( "printResolvedVersions" ) {
87+
description = "Print the resolved hibernate-orm-core and vert.x versions"
88+
doLast {
89+
def hibernateCoreVersion = "n/a"
90+
def vertxVersion = "n/a"
91+
92+
// Resolve Hibernate Core and Vert.x versions from compile classpath
93+
configurations.compileClasspath.resolvedConfiguration.resolvedArtifacts.each { artifact ->
94+
if (artifact.moduleVersion.id.name == 'hibernate-core') {
95+
hibernateCoreVersion = artifact.moduleVersion.id.version
96+
}
97+
if (artifact.moduleVersion.id.group == 'io.vertx' && artifact.moduleVersion.id.name == 'vertx-sql-client') {
98+
vertxVersion = artifact.moduleVersion.id.version
99+
}
100+
}
101+
102+
// Print the resolved versions
103+
println "Resolved Hibernate ORM Core Version: ${hibernateCoreVersion}"
104+
println "Resolved Vert.x SQL client Version: ${vertxVersion}"
105+
}
106+
}
107+
108+
// Make the version printing task run before tests and JavaExec tasks
109+
tasks.withType( Test ).configureEach {
110+
dependsOn printResolvedVersions
111+
}
112+
113+
tasks.withType( JavaExec ).configureEach {
114+
dependsOn printResolvedVersions
115+
}

hibernate-reactive-core/build.gradle

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,35 @@ tasks.register( "testAll", Test ) {
157157
description = "Run tests for ${dbs}"
158158
dependsOn = dbs.collect( [] as HashSet ) { db -> "testDb${db}" }
159159
}
160+
161+
// Task to print the resolved versions of Hibernate ORM and Vert.x
162+
tasks.register( "printResolvedVersions" ) {
163+
description = "Print the resolved hibernate-orm-core and vert.x versions"
164+
doLast {
165+
def hibernateCoreVersion = "n/a"
166+
def vertxVersion = "n/a"
167+
168+
// Resolve Hibernate Core and Vert.x versions from compile classpath
169+
configurations.compileClasspath.resolvedConfiguration.resolvedArtifacts.each { artifact ->
170+
if (artifact.moduleVersion.id.name == 'hibernate-core') {
171+
hibernateCoreVersion = artifact.moduleVersion.id.version
172+
}
173+
if (artifact.moduleVersion.id.group == 'io.vertx' && artifact.moduleVersion.id.name == 'vertx-sql-client') {
174+
vertxVersion = artifact.moduleVersion.id.version
175+
}
176+
}
177+
178+
// Print the resolved versions
179+
println "Resolved Hibernate ORM Core Version: ${hibernateCoreVersion}"
180+
println "Resolved Vert.x SQL client Version: ${vertxVersion}"
181+
}
182+
}
183+
184+
// Make the version printing task run before tests and JavaExec tasks
185+
tasks.withType( Test ).configureEach {
186+
dependsOn printResolvedVersions
187+
}
188+
189+
tasks.withType( JavaExec ).configureEach {
190+
dependsOn printResolvedVersions
191+
}

0 commit comments

Comments
 (0)