New JVM host doesn’t work inside tests in maven (3...
# scripting
i
New JVM host doesn’t work inside tests in maven (3.6.3) + JDK 1.8:
Copy code
Cannot access script base class 'io.bootique.kotlin.config.ScriptingBQConfigurationScript'. Check your module classpath for missing or conflicting dependencies
Unresolved reference: addConfig
	at io.bootique.kotlin.config.KotlinScriptCompilerTest.execute simple script config file(KotlinScriptCompilerTest.kt:36)
https://travis-ci.org/github/bootique/bootique-kotlin/jobs/723554789#L863 On JDK 11+ looks good: https://travis-ci.org/github/bootique/bootique-kotlin/builds/723554788
Can it be because
Copy code
(ClassLoader.getSystemClassLoader() as URLClassLoader).urLs
is just:
Copy code
/Users/ruslan.ibrahimau/dev/bootique-kotlin/bootique-kotlin-config/target/surefire/surefirebooter8341356191622317372.jar
?
Copy code
/Users/ruslan.ibrahimau/dev/bootique-kotlin/bootique-kotlin-config/target/surefire/surefirebooter8341356191622317372.jar
Is just a single
MANIFEST.MF
with main-class and classpath
"java.class.path"
system property is contains all classpath on other hand (jars, target-testclasses and target/classes )
i
Sorry for the delay. Indeed maven uses non-standard classloading for test runners, so the scripting host fails to detect it using default methods (
scriptCompilationClasspathFromContext
or so). You need to either extract and configure compilation classpath manually, or set the
kotlin.script.classpath
to the proper value.
i
Thanks for reply, do you understand why it failing on jdk8, but not on jdk11?
i
Not really, but probably some context (e.g. thread context classloader) is being set correctly on JDK 11, and it allows the helper to extracl cp properly.
i
So this is probably not considered as a bug, and should be work around on consumer side?
i
It depends, of course. But I think it would be good if you will file an issue in YouTrack, so at least the situation could be recorded.
i