spring - Maven 和 Spring Boot - 不可解析的父 pom - repo.spring.io(未知主机)

标签 spring maven spring-boot pom.xml parent-pom

我正在尝试构建我的项目,但我得到了这个:

Non-resolvable parent POM: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.3.0.M3 from/to spring-snapshots (http://repo.spring.io/snapshot): repo.spring.io and 'parent.relativePath' points at no local POM @ line 16, column 10: Unknown host repo.spring.io -> [Help 2]

这是我指定 pom.xml 的父级的方式:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.0.M3</version>
    <relativePath></relativePath>
</parent>

这是空的,因此它强制 maven 在远程存储库中查找父级。但是,它说 repo.spring.io 是未知主机

这是我在 pom.xml 中定义存储库的方式:

<repositories>
    <repository>
        <id>spring-snapshots</id>
        <url>http://repo.spring.io/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>spring-milestones</id>
        <url>http://repo.spring.io/milestone</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <url>http://repo.spring.io/snapshot</url>
    </pluginRepository>
    <pluginRepository>
        <id>spring-milestones</id>
        <url>http://repo.spring.io/milestone</url>
    </pluginRepository>
</pluginRepositories>

有什么想法吗?

最佳答案

显然这是您的互联网连接问题。检查,如果您能联系到 http://repo.spring.io使用您的浏览器。如果是,请检查是否需要配置代理服务器。如果不是,您应该联系您的互联网提供商。

这里是关于如何为 Maven 配置代理服务器的文档:https://maven.apache.org/guides/mini/guide-proxies.html

关于spring - Maven 和 Spring Boot - 不可解析的父 pom - repo.spring.io(未知主机),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32125025/

相关文章:

java - Tomcat 为带空格的请求 URI 返回 505

带有两个 jar 的 docker 中的 Spring Boot

java - Spring MVC 'forward' 不适用于同一 URI 的 @PostMapping 和 @GetMapping 注解

java - 找不到引用的 bean 'jpaMappingContext'

java - Spring mvc。不区分大小写的获取参数映射

Maven 仅针对特定依赖项强制更新(mvn -U 用于选定依赖项)

java - Spring security UserDetailsS​​ervice 不工作

java - cobertura-maven-plugin 2.6 托管在任何地方?

java - 如何使用 mvn 命令从终端执行@SpringBootTest?

java - Spring MVC Scala 应用程序仅返回index.html页面,其余路由不起作用