Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven 若XML在intellij中运行,则构建工作正常,但命令行运行时出错_Maven_Intellij Idea_Compiler Errors_Automated Tests_Testng - Fatal编程技术网

Maven 若XML在intellij中运行,则构建工作正常,但命令行运行时出错

Maven 若XML在intellij中运行,则构建工作正常,但命令行运行时出错,maven,intellij-idea,compiler-errors,automated-tests,testng,Maven,Intellij Idea,Compiler Errors,Automated Tests,Testng,如果我在intellj中运行test.xml,一切正常,测试就成功运行了 但是,如果我尝试在命令行中使用以下代码“mvn clean compile”运行测试 我会遇到如下错误: [ERROR] symbol: class IInvokedMethod [ERROR] location: class core.Web.RetryMethods.RetryListenerClass [ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia

如果我在intellj中运行test.xml,一切正常,测试就成功运行了

但是,如果我尝试在命令行中使用以下代码“mvn clean compile”运行测试

我会遇到如下错误:

[ERROR] symbol:   class IInvokedMethod
[ERROR] location: class core.Web.RetryMethods.RetryListenerClass
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/Web/RetryMethods/RetryListenerClass.java:[63,68] cannot find symbol
[ERROR] symbol:   class ITestResult
[ERROR] location: class core.Web.RetryMethods.RetryListenerClass
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/api/DataForAPI.java:[5,1] package org.testng does not exist
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/api/DataForAPI.java:[77,96] cannot find symbol
[ERROR] symbol:   class ITestResult
[ERROR] location: class core.TestRail.api.DataForAPI
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/TestRailMethods/TestCases.java:[7,1] package org.testng does not exist
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/TestRailMethods/TestCases.java:[8,1] package org.testng.internal does not exist
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/TestRailMethods/TestCases.java:[58,46] cannot find symbol
[ERROR] symbol:   class ISuite
我能在这里做什么? 我曾尝试更新testng jar,但没有帮助

附言。 删除范围标记后出现错误:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.436 s
[INFO] Finished at: 2021-03-30T09:38:25+03:00
[INFO] Final Memory: 30M/279M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project automation: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\Vartotojas\Desktop\Automatiniai testia\automation\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_212\jre\bin\java" -javaagent:C:\Users\Vartotojas\.m2\repository/org/aspectj/aspectjweaver/1.9.2/aspectjweaver-1.9.2.jar -jar C:\Users\VARTOT~1\
AppData\Local\Temp\surefire2399529717162338559\surefirebooter2518614099656505245.jar C:\Users\Vartotojas\AppData\Local\Temp\surefire2399529717162338559 2021-03-30T09-38-22_595-jvmRun1 surefire440322083299018669
4tmp surefire_04103581849292117664tmp"
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_212\jre\bin\java" -javaagent:C:\Users\Vartotojas\.m2\repository/org/aspectj/aspectjweaver/1.9.2/aspectjweaver-1.9.2.jar -jar C:\Users\VARTOT~1\
AppData\Local\Temp\surefire2399529717162338559\surefirebooter2518614099656505245.jar C:\Users\Vartotojas\AppData\Local\Temp\surefire2399529717162338559 2021-03-30T09-38-22_595-jvmRun1 surefire440322083299018669
4tmp surefire_04103581849292117664tmp"

当您在pom文件中添加
TestNG
依赖项时,看起来您添加了
test

这将导致TestNG相关类仅在类路径中对您的测试可见(即驻留在
src/test/Java
中的所有Java代码)


如果删除此选项,则与TestNG相关的类将在
src/main/java
src/test/java
的类路径中可见。

谢谢您的回答。我已经删除了那个范围标记,并出现了一些新的错误。请检查更新的描述。您的项目中有测试失败。因此,请打开您的
target/surefire reports
文件夹查看报告,查看失败的内容并采取纠正措施。如果回答了您最初的问题,请接受答案