Skip to content

Commit 52b5b1f

Browse files
committed
[hibernate#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 51371ba commit 52b5b1f

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
@@ -167,3 +167,35 @@ tasks.register( "testAll", Test ) {
167167
description = "Run tests for ${dbs}"
168168
dependsOn = dbs.collect( [] as HashSet ) { db -> "testDb${db}" }
169169
}
170+
171+
// Task to print the resolved versions of Hibernate ORM and Vert.x
172+
tasks.register( "printResolvedVersions" ) {
173+
description = "Print the resolved hibernate-orm-core and vert.x versions"
174+
doLast {
175+
def hibernateCoreVersion = "n/a"
176+
def vertxVersion = "n/a"
177+
178+
// Resolve Hibernate Core and Vert.x versions from compile classpath
179+
configurations.compileClasspath.resolvedConfiguration.resolvedArtifacts.each { artifact ->
180+
if (artifact.moduleVersion.id.name == 'hibernate-core') {
181+
hibernateCoreVersion = artifact.moduleVersion.id.version
182+
}
183+
if (artifact.moduleVersion.id.group == 'io.vertx' && artifact.moduleVersion.id.name == 'vertx-sql-client') {
184+
vertxVersion = artifact.moduleVersion.id.version
185+
}
186+
}
187+
188+
// Print the resolved versions
189+
println "Resolved Hibernate ORM Core Version: ${hibernateCoreVersion}"
190+
println "Resolved Vert.x SQL client Version: ${vertxVersion}"
191+
}
192+
}
193+
194+
// Make the version printing task run before tests and JavaExec tasks
195+
tasks.withType( Test ).configureEach {
196+
dependsOn printResolvedVersions
197+
}
198+
199+
tasks.withType( JavaExec ).configureEach {
200+
dependsOn printResolvedVersions
201+
}

0 commit comments

Comments
 (0)