首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法解决的导入POM失败查找

无法解决的导入POM失败查找
EN

Stack Overflow用户
提问于 2017-11-14 07:46:19
回答 2查看 24.8K关注 0票数 10

我在父pom中尝试了类似spring引导的模块,现在我遇到了错误。

代码语言:javascript
复制
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Failure to find org.springframework.boot:spring-boot-dependencies:pom:2.0.0.M6 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 @ line 30, column 19
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project mydomain.project:main-project:1.0-SNAPSHOT (D:\gitProjects\main-server\sources\pom.xml) has 1 error
[ERROR]     Non-resolvable import POM: Failure to find org.springframework.boot:spring-boot-dependencies:pom:2.0.0.M6 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 @ line 30, column 19 -> [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

我尝试在.m2本地回购中删除我的项目

我有带有两个模块的maven项目(简单的java和spring引导)。我将父程序从spring引导提取到主pom (如dependensyManagment ),并将paren设置为spring引导-主项目。在那之后,我得到了这个错误

我恢复更改,所有操作都很好。一步地点,当所有的人压碎

  1. 我把这个添加到主pom中

org.springframework.boot spring-启动依赖项2.0.0.M6pom导入

  1. 在春季启动时,我改变了这个

org.springframework.boot弹簧-启动-启动器-双亲2.0.0.M6

对此:

代码语言:javascript
复制
<parent>
        <artifactId>main-project</artifactId>
        <groupId>main.project</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-11-14 08:21:50

版本2.0.0.M6不在回购http://repo.maven.apache.org/maven2中。如果您不想使用此版本,则必须使用maven repo http://repo.spring.io/milestone。因此,将其添加到POM文件中:

代码语言:javascript
复制
<repositories>
    <repository>
        <id>spring-milestone-repo</id>
        <url>http://repo.spring.io/milestone/</url>
    </repository>
</repositories>

我建议您使用spring的最新版本(1.5.8.RELEASE),而不是里程碑版本。我不知道POM是什么样子,但是您可以用不同的方式在POM中定义spring引导:

1.使用Spring父POM

代码语言:javascript
复制
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.8.RELEASE</version>
</parent>

然后,可以添加希望使用的依赖项,例如:

代码语言:javascript
复制
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

请参阅:https://spring.io/guides/gs/spring-boot/

2.声明Spring中的依赖项-管理

如果您已经使用了自己的父POM,还可以在POM中导入spring引导依赖关系管理:

代码语言:javascript
复制
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>1.5.8.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

与变量1一样,您可以在以后声明您希望使用的spring引导的依赖项。

票数 9
EN

Stack Overflow用户

发布于 2020-08-27 09:05:44

检查是否添加了spring启动依赖项,并且已经将spring引导作为父程序。那是我的案子。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47280247

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档