Sorry this might not be the best answer, but I was having the same issue, and I am replying in hopes to unstuck you while a better answer comes along( I'd love to have a better understanding of why this is happening)
If you installed Maven via Homebrew you are probably using a different JDK version than the one set on JAVA_HOME.
You can run mvn -version
to confirm. In my case I got this:
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /opt/homebrew/Cellar/maven/3.8.4/libexec
Java version: 17.0.1, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk/17.0.1_1/libexec/openjdk.jdk/Contents/Home
Default locale: en_MX, platform encoding: UTF-8
Notice that the Java version is set to open jdk17, while JAVA_HOME is set to 11 in my case.
What I did to force maven run my JAVA_HOME version was to use:
JAVA_HOME=$JAVA_HOME mvn clean install
That is all I had to do in order to fix ant's Unable to create javax script engine for javascript
I was working a different project( not cassandra) but your question resembles a lot both my environment and the debug output I was getting.
Again, hopefully this reply would generate some activity and someone with more experience in Maven could provide a much better input than I.
Hope this helps anyone having a similar issue.