在STS IDE中创建Spring starter项目项目时pom.xml出错

时间:2017-03-23 14:26:19

标签: spring maven pom.xml

项目构建错误:

  

com.example的不可解析的父POM:demo:0.0.1-SNAPSHOT:无法传输org.springframework.boot:spring-boot-starter-parent:pom:1.5.2.RELEASE from {{3}如果缓存在本地存储库中,则在中心的更新间隔过去或强制更新之前,不会重新尝试解析。原始错误:无法传输工件org.springframework.boot:spring-boot-starter-parent:pom:1.5.2.RELEASE from / to central(https://repo.maven.apache.org/maven2):connect timed out和'parent.relativePath'points在没有当地的POM

我该如何解决这个问题?

这是我的POM.XML文件:

<?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>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

1 个答案:

答案 0 :(得分:0)

尝试强制更新依赖项。您的.m2可能有问题。 mvn clean install -U