在maven pom.xml中运行TestNG框架的testng.xml

时间:2014-09-17 10:58:46

标签: maven

我是maven的新手。我执行测试时遇到此错误:

`enter code here`[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
    [INFO] Compiling 1 source file to C:\Users\Nikita.Nayak\workspace\123\target\test-classes
    [INFO] -------------------------------------------------------------
    [ERROR] COMPILATION ERROR : 
    [INFO] -------------------------------------------------------------
    [ERROR] Unable to locate the Javac Compiler in:
      C:\Program Files\Java\jre7\..\lib\tools.jar
    Please ensure you are using JDK 1.4 or above and
    not a JRE (the com.sun.tools.javac.Main class is required).
    In most cases you can change the location of your Java
    installation by setting the JAVA_HOME environment variable.
    [INFO] 1 error
    [INFO] -------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.156s
    [INFO] Finished at: Wed Sep 17 16:21:59 IST 2014
    [INFO] Final Memory: 6M/15M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (default-testCompile) on project 123: Compilation failure
    [ERROR] Unable to locate the Javac Compiler in:
    [ERROR] C:\Program Files\Java\jre7\..\lib\tools.jar
    [ERROR] Please ensure you are using JDK 1.4 or above and
    [ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
    [ERROR] In most cases you can change the location of your Java
    [ERROR] installation by setting the JAVA_HOME environment variable.

1 个答案:

答案 0 :(得分:0)

问题似乎是您的Java配置。检查您是否拥有正确的JDK版本,并尝试为其定义正确的路径:https://stackoverflow.com/a/6718916/4065027

希望有所帮助