没有下载org.springframework:org.springframework.core:3.2.2.RELEA



我使用intellij创建了一个小java应用程序,后来我使用"添加框架支持"选项将该项目更新为Maven项目。当我试图在项目上添加spring jar文件时,我得到了以下错误,"没有文件下载为org.springframework:org.springframework.core:3.2.2.RELEASE"。

以下是我添加spring jar文件的步骤

1)点击File -> Project Structure -> Modules ->点击"+"符号-> Library -> From Maven

2)搜索org.springframework.core,选择3.2.2 Release

下载到我项目下的lib文件夹

4)有错误。

我不知道哪里出错了。我是java和spring应用程序的新手。

正如前面提到的,Maven自己下载依赖项(这就是为什么它是一个构建自动化工具的原因)。

要将Spring添加为依赖项,将以下代码添加到Maven的pom.xml中(该文件位于模块的根目录中):

<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>3.2.2.RELEASE</version>
    </dependency>
</dependencies>

同时,从你的项目根目录中删除lib目录——Maven不会把jar放在那里。

Maven自动下载依赖项,您可以尝试将其添加到pom.xml文件中吗?Maven应该会自动下载依赖项。

<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>3.2.2.RELEASE</version>
</dependency>

相关内容

最新更新