【问题标题】:Adding JDBC dependency causes all artifacts to go missing添加 JDBC 依赖项会导致所有工件丢失
【发布时间】:2018-03-18 15:48:12
【问题描述】:

我的项目中成功构建了 6 个左右的 maven 依赖项。但是,当我尝试添加 JDBC 依赖项时,我收到所有现有工件的错误消息:

缺少工件 mysql:mysql-connector-java:jar:5.1.6

缺少工件 org.springframework:spring-aop:jar:3.2.3.RELEASE

缺少工件 org.springframework:spring-beans:jar:3.2.3.RELEASE

缺少工件 org.springframework:spring-context:jar:3.2.3.RELEASE

缺少工件 org.springframework:spring-core:jar:3.2.3.RELEASE

缺少工件 org.springframework:spring-expression:jar:3.2.3.RELEASE

缺少工件 org.springframework:spring-jdbc:jar:4.3.10.RELEASE

这是我要添加的依赖项:(看起来像有效的 XML)

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>4.3.10.RELEASE</version>
</dependency>

之前的有效 Pom.xml:

添加 JDBC 依赖后 Pom.xml 出错:

我已经检查过,根据 Maven 站点,4.3.10.RELEASE 是一个有效的版本。

有谁知道为什么添加这个依赖会导致整个 Pom.xml 出错?

【问题讨论】:

    标签: eclipse maven pom.xml


    【解决方案1】:

    原来我的{User_Home}/.m2/settings.xml 文件中有错字。由于设置文件不可读,这导致新的 Maven 构建在更新时全部失败。

    【讨论】:

    • 很高兴你找到了。我有时会在更改 Maven 依赖项后看到 eclipse 崩溃。例如,我可能能够从命令行运行 maven 安装,但 eclipse 会标记一些带有编译错误的类。发生这种情况时,通常清理 eclipse 项目并在 eclipse 中重建即可解决问题。
    猜你喜欢
    • 2019-04-07
    • 2023-04-08
    • 1970-01-01
    • 1970-01-01
    • 2015-01-03
    • 1970-01-01
    • 2019-02-09
    • 2020-03-05
    • 2019-05-22
    相关资源
    最近更新 更多