简体   繁体   English

不可解析的导入 POM 找不到

[英]Non-resolvable import POM Failure to find

I experimented with spring boot like module in parent pom and now I get error我在父 pom 中尝试了类似 spring boot 的模块,现在出现错误

[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

I tried delete myproject in .m2 local repo我尝试在.m2本地存储库中删除 myproject

I have maven project with 2 modules(simple java and spring boot).我有 2 个模块的 Maven 项目(简单的 Java 和 Spring Boot)。 I extract parent from spring boot to main pom like dependensyManagment and set paren to spring boot - main project.我像dependensyManagment一样从spring boot中提取父级到主pom并将paren设置为spring boot - main project。 After that I get this error之后我收到这个错误

I revert changes and all works fine.我恢复更改并且一切正常。 The step by step I faunt point when all crush一步一步我放肆点当所有的美眉

  1. I add this to main pom我将此添加到主 pom
 <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>2.0.0.M6</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
  1. in spring boot I change this在弹簧靴中我改变了这个
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.0.M6</version> <relativePath/> <!-- lookup parent from repository --> </parent>

to this:对此:

<parent>
        <artifactId>main-project</artifactId>
        <groupId>main.project</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>

The version 2.0.0.M6 isn't located in the repo http://repo.maven.apache.org/maven2 .版本 2.0.0.M6 不在 repo http://repo.maven.apache.org/maven2 中 If you wan't to use this version you have to use the maven repo http://repo.spring.io/milestone .如果你不想使用这个版本,你必须使用 maven repo http://repo.spring.io/milestone So add it to your POM file:所以将它添加到你的 POM 文件中:

<repositories>
    <repository>
        <id>spring-milestone-repo</id>
        <url>http://repo.spring.io/milestone/</url>
    </repository>
</repositories>

I would recommend you to use the latest release version of spring-boot (1.5.8.RELEASE), not a milestone version.我建议您使用 spring-boot (1.5.8.RELEASE) 的最新发布版本,而不是里程碑版本。 I don't know how your POM looks like, but you can define spring boot in your POM in different ways:我不知道你的 POM 是什么样子,但你可以用不同的方式在你的 POM 中定义 spring boot:

1. Using the Spring Boot parent POM 1.使用Spring Boot父POM

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

Then you can add the dependencies you wish to use eg:然后你可以添加你想要使用的依赖项,例如:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

See: https://spring.io/guides/gs/spring-boot/见: https : //spring.io/guides/gs/spring-boot/

2. Declare Spring-Boot in Dependency-Management 2. 在依赖管理中声明 Spring-Boot

If you already using an own parent POM, you could also import the spring boot dependency management in your POM:如果你已经在使用自己的父 POM,你也可以在你的 POM 中导入 spring boot 依赖管理:

<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>

Same as in variant #1 you can declare afterwards the dependencies of spring boot you wish to use.与变体#1 相同,您可以在之后声明您希望使用的spring boot 的依赖项。

Check if you didn't add spring boot dependency having already spring-boot as parent.检查您是否没有添加已经作为父级的 spring-boot 的 spring boot 依赖项。 That was my case.这就是我的情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Non-resolvable import POM: 传输失败 - Non-resolvable import POM: Failure to transfer Vaadin 8 alpha / beta预发行失败,并显示“无法解析的导入POM:找不到”错误 - Vaadin 8 alpha/beta prerelease fail with “Non-resolvable import POM: Failure to find” errors Wildfly 快速入门 不可解析的导入 POM:未能找到 org.wildfly:wildfly-parent:pom:20.0.0.Beta1-SNAPSHOT - Wildfly quickstart Non-resolvable import POM: Failure to find org.wildfly:wildfly-parent:pom:20.0.0.Beta1-SNAPSHOT Spring 项目 - 不可解析的导入 POM:未能找到 io.micrometer:micrometer-bom:pom:2.0.0-M3? - Spring Project - Non-resolvable import POM: Failure to find io.micrometer:micrometer-bom:pom:2.0.0-M3? Maven 不可解析的导入 POM - Maven Non-resolvable import POM 无法创建自定义BOM。 由于无法解析的导入POM,项目构建失败:找不到工件 - Cannot create custom BOM. Project build fails with Non-resolvable import POM: Could not find artifact Jenkins安装失败-错误“不可解析的导入POM” - Jenkins setup fails - Error “Non-resolvable import POM” 指定SNAPSHOT版本时无法解析的导入POM - Non-resolvable import POM when specifying SNAPSHOT version 不可解析的父 POM:找不到工件 - Non-resolvable parent POM: Could not find artifact Maven - 不可解析的父 POM,找不到工件快照 - Maven - Non-resolvable parent POM, Could not find artifact SNAPSHOT
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM