我在父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
我尝试在
.m2
本地存储库中删除myproject我有2个模块的Maven项目(简单的Java和Spring Boot)。我将spring boot的parent提取到像dependensyManagment这样的主pom,并将paren设置为spring boot-main项目。之后,我得到这个错误
我还原更改,一切正常。步步为营我当年点点暗恋
我在 Spring 启动时更改了
对此:
<parent>
<artifactId>main-project</artifactId>
<groupId>main.project</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
最佳答案
版本2.0.0.M6不在repo http://repo.maven.apache.org/maven2中。如果您不想使用此版本,则必须使用maven repo http://repo.spring.io/milestone。因此,将其添加到您的POM文件中:
<repositories>
<repository>
<id>spring-milestone-repo</id>
<url>http://repo.spring.io/milestone/</url>
</repository>
</repositories>
我建议您使用最新版本的spring-boot(1.5.8.RELEASE),而不是里程碑版本。我不知道您的POM是什么样子,但是您可以通过不同的方式在POM中定义spring boot:
1.使用Spring Boot父POM
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
</parent>
然后,您可以添加希望使用的依赖项,例如:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
另请:https://spring.io/guides/gs/spring-boot/
2.声明依赖管理中的Spring-Boot
如果您已经在使用自己的父POM,则还可以将Spring Boot依赖项管理导入到POM中:
<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 boot的依赖项。