@@ -10,13 +10,16 @@ plugins {
1010 id ' org.hibernate.build.xjc-jakarta'
1111}
1212
13+ repositories {
14+ gradlePluginPortal()
15+ }
16+
1317description = ' Hibernate\' s core ORM functionality'
1418
1519apply from : rootProject. file( ' gradle/published-java-module.gradle' )
1620apply plugin : ' org.hibernate.orm.antlr'
1721apply plugin : ' org.hibernate.matrix-test'
1822
19-
2023configurations {
2124 tests {
2225 description = ' Configuration for the produced test jar'
@@ -45,6 +48,7 @@ dependencies {
4548 compileOnly jakartaLibs. jsonbApi
4649 compileOnly libs. jackson
4750 compileOnly libs. jacksonXml
51+ compileOnly dbLibs. postgresql
4852
4953 testImplementation project(' :hibernate-testing' )
5054 testImplementation project(' :hibernate-ant' )
@@ -62,14 +66,15 @@ dependencies {
6266 }
6367 testImplementation " joda-time:joda-time:2.3"
6468 testImplementation files(' /app/libs/aws-advanced-jdbc-wrapper-2.3.3.jar' )
65- testImplementation dbLibs. postgresql
66- testImplementation dbLibs. mysql
6769 testImplementation dbLibs. h2
6870
6971 testRuntimeOnly libs. byteBuddy
7072 testRuntimeOnly testLibs. weld
7173 testRuntimeOnly testLibs. wildFlyTxnClient
74+ testRuntimeOnly jakartaLibs. jsonb
7275 testRuntimeOnly libs. jackson
76+ testRuntimeOnly libs. jacksonXml
77+ testRuntimeOnly libs. jacksonJsr310
7378
7479 testAnnotationProcessor project( ' :hibernate-jpamodelgen' )
7580
@@ -105,10 +110,8 @@ sourceSets {
105110 }
106111 }
107112
108- // resources inherently exclude sources
109113 test {
110114 resources {
111- srcDir ' src/test/java'
112115 srcDir ' src/test/resources'
113116 srcDir ' src/test/bundles'
114117 }
@@ -240,13 +243,16 @@ tasks.withType( Test.class ).each { test ->
240243 test. jvmArgs( [' --add-opens' , ' java.base/java.security=ALL-UNNAMED' ] )
241244 test. jvmArgs( [' --add-opens' , ' java.base/java.lang=ALL-UNNAMED' ] )
242245
246+ // Avoid Log4J2 classloader leaks:
247+ test. jvmArgs( [' -Dlog4j2.disableJmx=true' ] )
248+
243249 test. beforeTest { descriptor ->
244250 // println "Starting test: " + descriptor
245251 }
246252}
247253
248254// Tests with records
249- if ( gradle . ext . javaVersions . test. release. asInt() >= 17 && gradle . ext . javaToolchainEnabled ) {
255+ if ( jdkVersions . test. release. asInt() >= 17 && jdkVersions . explicit ) {
250256
251257 // Add a new source set, which contains tests that can run on JDK17+
252258 sourceSets {
@@ -256,15 +262,15 @@ if ( gradle.ext.javaVersions.test.release.asInt() >= 17 && gradle.ext.javaToolch
256262 }
257263 // Refer to the main test resources to avoid processing variables twice
258264 resources {
259- srcDir ' target/resources/test '
265+ srcDirs tasks . processTestResources
260266 }
261267 }
262268 }
263269
264270 // For the new source set, we need to configure the source and target version to 17
265271 compileTestJava17Java {
266272 javaCompiler = javaToolchains. compilerFor {
267- languageVersion = gradle . ext . javaVersions . test. compiler
273+ languageVersion = jdkVersions . test. compiler
268274 }
269275 sourceCompatibility = 17
270276 targetCompatibility = 17
@@ -275,6 +281,7 @@ if ( gradle.ext.javaVersions.test.release.asInt() >= 17 && gradle.ext.javaToolch
275281 // The source set gets a custom configuration which extends the normal test implementation config
276282 configurations {
277283 testJava17Implementation. extendsFrom(testImplementation, testRuntimeOnly)
284+ testJava17CompileOnly. extendsFrom(testCompileOnly)
278285 }
279286
280287 // Add the output from src/main/java as dependency
@@ -287,14 +294,14 @@ if ( gradle.ext.javaVersions.test.release.asInt() >= 17 && gradle.ext.javaToolch
287294 // We execute the Java 17 tests in a custom test task
288295 task testJava17(type : Test ) {
289296 javaLauncher = javaToolchains. launcherFor {
290- languageVersion = gradle . ext . javaVersions . test. launcher
297+ languageVersion = jdkVersions . test. launcher
291298 }
292299 useJUnitPlatform()
293300 testClassesDirs = sourceSets. testJava17. output. classesDirs
294301 classpath = sourceSets. testJava17. runtimeClasspath
295302
296- if ( gradle . ext . javaVersions . test. launcher. asInt() >= 19 ) {
297- logger. warn( " The version of Java bytecode that will be tested is not supported by Bytebuddy by default. " +
303+ if ( jdkVersions . test. launcher. asInt() >= 19 ) {
304+ logger. warn( " The version of Java bytecode that will be tested is not supported by Byte Buddy by default. " +
298305 " Setting 'net.bytebuddy.experimental=true'." )
299306 systemProperty ' net.bytebuddy.experimental' , true
300307 }
@@ -305,9 +312,13 @@ if ( gradle.ext.javaVersions.test.release.asInt() >= 17 && gradle.ext.javaToolch
305312 check. dependsOn testJava17
306313}
307314
308- javadoc {
315+ tasks . named( " javadoc" , Javadoc ) {
309316 configure(options) {
310- overview = ' src/main/javadoc/overview.html'
311- stylesheetFile = new File (projectDir, ' src/main/javadoc/stylesheet.css' )
317+ overview = rootProject. file( " shared/javadoc/overview.html" )
312318 }
313319}
320+
321+ tasks. sourcesJar. dependsOn ' :hibernate-core:generateGraphParser'
322+ tasks. sourcesJar. dependsOn ' :hibernate-core:generateHqlParser'
323+ tasks. sourcesJar. dependsOn ' :hibernate-core:generateSqlScriptParser'
324+ tasks. sourcesJar. dependsOn ' :hibernate-core:generateOrderingParser'
0 commit comments