在将Intellij中的项目重新加工为模块时,我遇到此错误:
"C:\Program Files\Java\jdk1.8.0_181\bin\java.exe" "-Dorg.jetbrains.run.directory=C:\Users\Ash\Documents\1_Code Stuff\Java\Udemy course\guru-pet-clinic" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2018.2.4\lib\idea_rt.jar=55768:C:\Program Files\JetBrains\IntelliJ IDEA 2018.2.4\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_181\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2018.2.4\plugins\cucumber-java\lib\cucumber-jvmFormatter.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2018.2.4\plugins\cucumber-java\lib\cucumber-jvmFormatter3.jar" cucumber.api.cli.Main --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm3SMFormatter "C:/Users/Ash/Documents/1_Code Stuff/Java/Udemy course/guru-pet-clinic"
Error: Could not find or load main class cucumber.cli.Main
答案 0 :(得分:0)
后来我发现由于重构,运行配置错误,然后默认设置,从而导致错误。
我修复该问题的方法是删除所有配置(在图像的右上角下拉),还通过选择并单击“-” <<>删除黄瓜java / p>
然后我右键单击要运行的Main应用程序,然后选择运行,或者按ctrl + shift + F10快捷键。
答案 1 :(得分:0)
我想我找到了解决方案。 通过将以下依赖项添加到pom.xml将清除上面的异常
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>5.7.0</version>
</dependency>
答案 2 :(得分:0)
对我来说,结果是我将实际主项目目录的父目录作为项目打开。当我在 IntelliJ 中打开正确的项目目录时,将“src”文件夹作为直接子文件夹,黄瓜工作了。 如需参考,请参阅此处的说明:https://www.jetbrains.com/help/idea/enabling-cucumber-support-in-project.html#folder-structure,以及此处的类似 StackOverflow 线程:Intellij IDEA Run configurations for Cucumber runner class。