无法使用Eclipse Junit运行配置运行Kotlin测试

时间:2019-07-22 20:54:47

标签: java eclipse kotlin

一个奇怪的问题是,运行我的Junit测试几个月的Junit运行配置刚刚停止工作,现在它不再可以查看/查找test.KotlinTestsRunner类(请参见图片[1]和[2]更多细节)。

[1]-https://www.eclipse.org/forums/index.php?t=getfile&id=35978&
[2]-https://www.eclipse.org/forums/index.php?t=getfile&id=35979&

似乎是Kotlin类路径问题(Java测试运行正常,请参见下文),但是任务的Dependencies选项卡包含Kotlin主目录和测试类所在的Kotlin构建目录:

../Kgt-4/build/classes/kotlin/main ../Kgt-4/build/classes/kotlin/test

Eclipse表示“在项目'Kgt-4'中找不到测试类'test.KotlinTestsRunner'(请参见上面的图片),但是test.KotlinTestsRunner在那里:

$ ls -l Kgt-4/build/classes/kotlin/test/test/KotlinTestsRunner.class -rw-r--r-- 1 luser luser 762 Jul 21 13:02 Kgt-4/build/classes/kotlin/test/test/KotlinTestsRunner.class

奇怪的是,如果我使用相同的类路径Junit运行配置来设置Java应用程序运行配置,并且可以正常运行,则可以运行Kotlin测试。我也可以在具有相同Junit配置(显然唯一的区别是测试类名称)的test.JavaTestsRunner类中进行Java测试,而不会出现任何问题。在这种情况下,命令行如下所示:

/usr/lib/jvm/java-11-openjdk-amd64/bin/java -ea -Dfile.encoding=ANSI_X3.4-1968 -classpath /home/luser/Work/Kgt-4/build/classes/kotlin/main:/home/luser/Work/Kgt-4/build/classes/kotlin/test:/home/luser/Work/Kgt-4/build/classes/java/main:/home/luser/Work/Kgt-4/build/classes/java/test:/home/luser/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.41/e24bd38de28a326cce8b1f0d61e809e9a92dad6a/kotlin-stdlib-1.3.41.jar:/home/luser/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.41/2ecf4aa059427d7186312fd1736afedf7972e7f7/kotlin-stdlib-common-1.3.41.jar:/home/luser/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar:/home/luser/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-test-junit/1.3.41/2ec43deb5225811cb0fd63385b7f9382a78cd225/kotlin-test-junit-1.3.41.jar:/home/luser/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-test/1.3.41/98efd6e69ef6f877b086dfd7894a4c36fe5d5736/kotlin-test-1.3.41.jar:/home/luser/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/2973d150c0dc1fefe998f834810d68f278ea58ec/junit-4.12.jar:/home/luser/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-test-annotations-common/1.3.41/f57e03dea3d1a81b5e1b3cdcf4eb2710a3fac173/kotlin-test-annotations-common-1.3.41.jar:/home/luser/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-test-common/1.3.41/744000c1a0ef654706ce3367a10543590dab9246/kotlin-test-common-1.3.41.jar:/home/luser/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar:/home/luser/.eclipse/org.eclipse.platform_4.12.0_297942815_linux_gtk_x86_64/configuration/org.eclipse.osgi/403/0/.cp:/home/luser/.eclipse/org.eclipse.platform_4.12.0_297942815_linux_gtk_x86_64/configuration/org.eclipse.osgi/402/0/.cp org.eclipse.jdt.internal.junit.runner.RemoteTestRunner -version 3 -port 39669 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -classNames test.JavaTestsRunner

$ ls -l Kgt-4/build/classes/java/test/test/JavaTestsRunner.class -rw-r--r-- 1 luser luser 666 Jul 21 13:02 Kgt-4/build/classes/java/test/test/JavaTestsRunner.class

问题首先出现在2019-3R,然后我移至2019-6R,但问题仍然存在。

有什么想法吗?谢谢

0 个答案:

没有答案