eclipse、新maven项目、spring boot—不拉取任何库

eclipse、新maven项目、spring boot—不拉取任何库,eclipse,spring,maven,Eclipse,Spring,Maven,我正试图在Eclipse中创建一个基本的Spring启动应用程序,但我发现Maven/Eclipse并没有使用必要的基本Spring框架JAR让我继续开发 我这样做: 1) 在Eclipse中,选择New->Maven Project 2) 在第二个对话框(跳过原型)中,我输入我的应用程序的所有信息,再加上输入父应用程序的信息,这样我得到的pom看起来与spring boot reference guide中的pom相同,减去我自己特定于我的项目的工件/组: <?xml version="

我正试图在Eclipse中创建一个基本的Spring启动应用程序,但我发现Maven/Eclipse并没有使用必要的基本Spring框架JAR让我继续开发

我这样做:

1) 在Eclipse中,选择New->Maven Project 2) 在第二个对话框(跳过原型)中,我输入我的应用程序的所有信息,再加上输入父应用程序的信息,这样我得到的pom看起来与spring boot reference guide中的pom相同,减去我自己特定于我的项目的工件/组:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>myproject</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <!-- Inherit defaults from Spring Boot -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.4.RELEASE</version>
    </parent>

    <!-- Add typical dependencies for a web application -->
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

    <!-- Package as an executable jar -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

4.0.0
com.example
我的项目
0.0.1-快照
org.springframework.boot
spring启动程序父级
1.2.4.1发布
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
springbootmaven插件
在这一点上,我在项目的Maven Dependencies文件夹中没有看到任何spring JAR,就像在其他项目中看到的一样(实际上该文件夹根本不存在),因此我尝试:

3) Maven->runas->Maven安装 它说构建成功。还是没有图书馆

4) 右键单击项目,Maven->更新项目,单击确定 仍然没有图书馆

因此,此时,当我创建Application.java类并将其放入注释@SpringBootApplication时,Eclipse将其标记为一个错误,即它“无法解析为类型”,并且没有自动修复程序从适当的库导入它,因为我的项目仍然没有提取任何spring jar


发生什么事了?我错过了什么?

我在项目构建路径中将变量添加到本地文件系统中spring JAR的副本中,从而绕过了这个问题。我认为这是一个代理问题,我无法访问正常的存储库。

您可以在pom.xml中添加以下内容,而不是复制本地jar,如果无法访问任何特定的存储库,您可以通过更改此配置属性切换到其他存储库

<repositories>
  <repository>
    <id>spring-releases</id>
    <name>Spring Releases</name>
    <url>https://repo.spring.io/libs-release</url>
  </repository>
</repositories>

<pluginRepositories>
  <pluginRepository>
    <id>spring-releases</id>
    <name>Spring Releases</name>
    <url>https://repo.spring.io/libs-release</url>
  </pluginRepository>
</pluginRepositories>

春假
春假
https://repo.spring.io/libs-release
春假
春假
https://repo.spring.io/libs-release