bytebang / vpl-junit

Run and grade JUnit testswithin the Virtual Programming Lab Plugin for Moodle
GNU General Public License v3.0
9 stars 5 forks source link

Using vpl-junit-0.8.jar with Kotlin classes fails with java.lang.NoClassDefFoundError #2

Open frankneumann opened 3 years ago

frankneumann commented 3 years ago

Hi,

I would like to use vpl-junit-0.8.jar with Kotlin classes as the latest VPL version included support for Kotlin.

When I evaluate the unit tests, I get the following error:

java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics --|> <|-- at: FractionKt.invert(Fraction.kt)

which means that the Kotlin STD Lib is missing, although I included it in class path:

search for Kotlin standard library and include it in class path

kotlin_std_lib=/opt/kotlin/lib/kotlin-stdlib.jar if [ -f $kotlin_std_lib ] ; then CLASSPATH=$CLASSPATH:$kotlin_std_lib fi

and

cat common_script.sh > vpl_execution echo "export CLASSPATH=$CLASSPATH" >> vpl_execution echo "timeout $vpl_junit_timeout java -jar $vpl_junit_version \$@" >> vpl_execution chmod +x vpl_execution

I attached all files.

Any hint on that very welcome.

Downloads.zip

bytebang commented 3 years ago

Thanks for the suggestion! I will test this in the near future and merge it into the codebase if it does not interfer with the current functionality

frankneumann commented 3 years ago

Thank you for your reply: Do you have any idea how a workaround for me could look like? I added the Kotlin STD lib to the class path and assume that your JAR should respect the settings of the class path.

bytebang commented 3 years ago

Since i am no Kotlin specialist, i have to look up how things are working there. Nevertheless, it uses the JVM, and there we can inject the classpath via the --classpath option.

Does your solution work on your machine ?

frankneumann commented 3 years ago

I found a workaround: I included the content of the Kotlin STD lin inside of your VPL JAR file and everything works perfectly. I still have no clue why setting the classpath does not help. Thank you for your help and for your lib - it is very helpful. May be you find a more elegant solution.