我想添加 sql jdbc 驱动程序的依赖项。以下是我在 pom.xml 中添加的片段
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.5.0.jre9-preview</version>
<scope>test</scope>
</dependency>
然后我右键单击该项目并单击 maven Install,这里出现构建失败错误。它已下载 jar 文件,但出现以下错误。
Console output:
- maven-compiler-plugin:3.1:compile (default-compile) @ hybridFramework ---
[INFO] Changes detected - recompiling the module!
[
INFO] Compiling 27 source files to C:\Automation Testing softwares\seleniumHybridFramework-master\target\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: 37.761 s
[INFO] Finished at: 2018-03-29T17:20:22+05:30
[INFO] Final Memory: 13M/45M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project hybridFramework: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[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
有人可以帮我吗?..
最佳答案
问题不是由依赖关系引起的,而是如构建日志中明确指出的:
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
设置您的 JAVA_HOME 并使 Selenium WebDriver 看起来像 here
关于java - 在 pom.xml 中添加 sql jdbc 驱动程序的 Maven 依赖项时生成失败错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49555916/