java - 在 pom.xml 中添加 sql jdbc 驱动程序的 Maven 依赖项时生成失败错误

标签 java database eclipse maven

我想添加 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/

相关文章:

java - Spring 找不到 Maven 依赖项中的 jar

java - 将 XMLGregorianCalendar 转换为 MM/dd/yyyy hh :mm String? 的最佳方法是什么

java - 使用 TelegramLongPollingBot 和线程同时处理多个用户

database - Elasticsearch match_phrase_prefix无法找到所有记录

database - PostgreSQL - 产品的最佳数据库模型和该产品的多种评级类型是什么?

Eclipse 单击部署到远程 Tomcat

java - Easymock 部分模拟(EasyMock ClassExtension),好还是坏?

database - 在查询之前找到粗略时间的算法

java - Java类中的静态变量无法解析或不是字段

eclipse - 在 Eclipse 中撤消 "remember my decision"以实现团队同步透视