在VSCODE中使用Junit 5时找不到或加载主类
在VSCODE中使用Junit 5时,我目前正在面临问题。
我注意到,一旦“ junit-platform-console-standalone-1.7.0-m1.jar”就在我项目的库文件夹中,我可以运行测试,但我无法再运行主要方法(“错误) :找不到或加载主类”)。一旦删除.jar,我就可以立即再次运行它。
当我将默认项目与无构建工具一起使用时,问题也会发生。
我创建了一个简单的测试类,并让.jar文件通过“ Testing” Explorer自动下载(启用Java测试按钮)。现在下载了.jar文件,测试可以正常工作,但主要方法不行。如果我将.jar从文件夹中删除,则主要方法再次工作,但显然测试AINT。
是否可以同时运行?先感谢您!
I am currently facing problems when using JUnit 5 in VSCode.
I noticed that as soon as the "junit-platform-console-standalone-1.7.0-M1.jar" is in my library folder within my project I can run my tests but I can not run my main method any more ("Error: Could not find or load main class"). As soon as I remove the .jar I can immediately run it again.
The problem also occurs when I use the default project with no-build tools.
I created a simple test class and let the .jar file automatically download via the "Testing" explorer (enable Java Tests Button). Now that the .jar file is downloaded, the tests work but the main method doesn't. If I remove the .jar out of the folder, the main method works again but obviously the tests aint.
Any solutions so I can run both? Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在不了解您的项目的情况下,这里有一些解决方法可能会有所帮助:
清洁Java语言服务器工作区
。aumination.json
文件中添加mainclass
和sourcepath
配置。清洁Java语言服务器工作区
。希望这对您有帮助。
Without knowing more about your project, here are a few workarounds that might help:
Clean the java language server workspace
.mainClass
andsourcePaths
configuration in yourlaunch.json
file.Clean the java language server workspace
.Hope this helps you.