you might get a scriptexception when using kotlin scriptengine in tests with maven

I was able to get the unit tests to work on the command line. The issue was the surefire plugin that would use a manifest-only jar that would contain the classpath. For some reason, the order in which the jars were listed in that manifest-only jar caused the issues that OP describes above. I was able to fix this issue by setting surefire.useManifestOnlyJar=false, either in pom.xml


or as command line argument for Maven:

mvn -Dsurefire.useManifestOnlyJar=false test

For more details on that property, see

mvn surefire:help -Ddetail=true

This resolves the problem for me.

There is also documentation on class loading with surefire:

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top