Maven" test"命令无法从命令行运行,使用eclilpse

时间:2018-03-14 22:41:27

标签: java eclipse maven selenium

我正面临" JRE"执行" test"时出错从命令行命令,但"清理"命令工作正常,我已经尝试配置" JDK"环境变量中的路径但仍未解决问题。

系统变量:

Name:JAVA_HOME , value:C:\Program Files\Java\jdk1.8.0_73

我也尝试配置路径变量:

set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_73"
echo %JAVA_HOME%
set PATH=%PATH%;%JAVA_HOME%\bin
echo %PATH%

在配置上面后,我观察到以下错误:

PS F:\softy\workspace_softy\farziBada2> mvn clean
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE

我已将JAVA_HOME perior配置为PATH变量,但随后mvn clean 也行不通

没有任何作用。

在Eclipse中,我将jdk路径指向编译器,这两个命令都可以正常工作。 MVN测试的输出:

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building farziBada2 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ farziBada2 ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ farziBada2 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ farziBada2 ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ farziBada2 ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 3 source files to F:\softy\workspace_softy\farziBada2\target\test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.175 s
[INFO] Finished at: 2018-03-15T03:49:20+05:30
[INFO] Final Memory: 10M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project farziBada2: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

MVN Clean的输出: mvn clean:

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building farziBada2 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ farziBada2 ---
[INFO] Deleting F:\softy\workspace_softy\farziBada2\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.275 s
[INFO] Finished at: 2018-03-15T03:55:23+05:30
[INFO] Final Memory: 6M/123M
[INFO] ------------------------------------------------------------------------

请帮助解决问题。

0 个答案:

没有答案