【问题标题】:Cannot install spring-boot-starter-parent no matter what I do无论我做什么都无法安装 spring-boot-starter-parent
【发布时间】:2018-05-20 18:44:33
【问题描述】:

我刚刚设置了一台新计算机——全新的 Java 1.8 安装,新的 3.5.2 Maven 配置,我现在正在设置一个全新的快速启动 Maven 项目。

当我添加父 spring boot 启动器和单个依赖项时,无论我做什么都无法解决。

这是踪迹:

[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.boot:das-boot:1.0-SNAPSHOT: Failure to find org.springframework.boot:spring-boot-starter-parent:pom:1.5.9-RELEASE in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 10, column 11
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.boot:das-boot:1.0-SNAPSHOT (D:\workspace\das-boot\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.boot:das-boot:1.0-SNAPSHOT: Failure to find org.springframework.boot:spring-boot-starter-parent:pom:1.5.9-RELEASE in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 10, column 11 -> [Help 2]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

这是我完整的pom.xml

<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.boot</groupId>
  <artifactId>das-boot</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9-RELEASE</version>
  </parent>

  <name>das-boot</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

mvn -version的输出:

D:\workspace\das-boot>mvn -version
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T00:58:13-07:00)
Maven home: C:\Program Files\apache-maven-3.5.2\bin\..
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_151\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

可能会发生什么?我没有使用代理,它在 IntelliJ 和 CMD 中失败,并且所有内容都是全新安装的,带有默认设置。

【问题讨论】:

  • 确实如此。输出添加到问题正文
  • 在您的 IDE 中,您的项目上的 Rigth 按钮 -> Maven -> 更新?
  • 我一直在运行 IntelliJ 的“重新导入”,但似乎没有帮助
  • 他们的问题似乎特别针对获取快照构建。由于我要发布一个版本,据我所知,除了 Maven Central 之外,我不应该指向任何东西

标签: java spring windows maven


【解决方案1】:

1.5.9.RELEASE,根据their website,不是1.5.9-RELEASE

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
</parent>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

【讨论】:

  • 我知道这一定是一些愚蠢的事情.. 非常感谢大声笑.. 有时编程时感觉像大学新生是多么容易,这总是让我感到惊讶
  • 我的代码与此答案相同(在 RELEASE 之前有一个“点”)。但仍然有与问题相同的错误。请问有什么建议吗?
  • @RDhaval 请发布一个至少包含您的 pom 和错误的问题。
  • 我现在解决了,格式化我的系统后,我忘记在 m2 中添加 settings.xml 文件。那真是太傻了。
猜你喜欢
  • 2022-07-30
  • 2021-04-29
  • 2020-03-17
  • 2012-03-11
  • 2017-09-04
  • 2022-11-10
  • 2020-11-06
  • 1970-01-01
  • 2023-01-30
相关资源
最近更新 更多