I started fiddling around Hibernate Validator, OSS Project in order to fork it later. But I cannot run the tests locally. I followed the official documentation for Contributing to Hibernate Validator which has a section for Building from Source.
So why asking on SO instead?
I've been rumbling about this for a couple of months now and last weekend, a friend decided to look into it. Initially, it failed just as with on my PC. But he checked out the 8.0.1.Final tag and it succeeded.
So late last night, I tried it and failed. It happens that:
- he is on Windows, using JDK 17 from Oracle vs. I'm on Ubuntu 22.04 with Oracle JDK 17
- previously, I failed with Graal VM for JDK 19, OpenLogic's JDK 17
- he's on Maven
3.9.3and I tried on3.9.0&3.9.4
Some module test passed with Maven 3.9.4 & Oracle's JDK 17:
Apache Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9)
Maven home: /home/salathiel/.local/bin/maven
Java version: 17.0.8, vendor: Oracle Corporation, runtime: /home/salathiel/.local/opt/jdk-17.0.8
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "6.2.0-26-generic", arch: "amd64", family: "unix"
Personal Reflections
I do not think a Java project as Hibernate is made to be developed on Windows only, nor compiled with a specific JDK version/edition. I must be missing on something fundamental.
Enough whining
I'm concerned with two weird exceptions:
- NoClassDefFound
- JavaSecurityException
Here is the stack trace:
[INFO] Running TestSuite
[ERROR] Tests run: 982, Failures: 963, Errors: 0, Skipped: 0, Time elapsed: 24.262 s <<< FAILURE! - in TestSuite
[ERROR] testUnknownProviderConfiguredInValidationXml(org.hibernate.beanvalidation.tck.tests.bootstrap.customprovider.BootstrapNonAvailableValidationProviderTest) Time elapsed: 0.037 s <<< FAILURE!
org.testng.TestException:
Expected exception of type class jakarta.validation.ValidationException but got java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "setContextClassLoader")
at org.hibernate.beanvalidation.tck.tests.bootstrap.customprovider.BootstrapNonAvailableValidationProviderTest.testUnknownProviderConfiguredInValidationXml(BootstrapNonAvailableValidationProviderTest.java:58)
[...]
Expected exception of type class jakarta.validation.ValidationException but got java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "setContextClassLoader")
at org.hibernate.beanvalidation.tck.tests.xmlconfiguration.versioning.UnknownVersionInValidationXmlTest.testValidationXmlWithUnknownSchemaVersion(UnknownVersionInValidationXmlTest.java:43)
[...]
[INFO]
[ERROR] Tests run: 982, Failures: 963, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
Maven revolves around goals which are composable (eg.:
testgoals is made ofcompilegoal, same is true forinstallandtest, respectively).AFAIK,
installgoal willtest,compile,packageandcopy artifact to local repository.In order to avoid the latter side effect (polluting my local repository because it is shared across projects), I have been doing
... Until this morning:mvn clean testhibernate-validator-distributionthen failed with:I had
JAVA_HOME="..."in both my ~/.bashrc and ~/.ondirrc but the fix was:NOTE TO SELF: I guess I don't know what I don't know.