Spring 2.2.1构建错误无法找到工件com.fasterxml.jackson:jackson-bom:pom:2.10.5

Jqu*_*oza 5 spring maven-3 maven spring-boot

我是 Spring boot 框架的新手,我spring-boot-starter-parent 在我的父 pom 中添加了 spring-boot-starter-parent

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.1.RELEASE</version>
        <relativePath/>     
</parent>
Run Code Online (Sandbox Code Playgroud)

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>
    <parent>
        <groupId>Parent</groupId>
        <artifactId>Parent</artifactId>
        <version>7.0.0.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>Child</artifactId>
    <packaging>pom</packaging>
    <version>7.0.0.0</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.compiler.version>1.8</java.compiler.version>
        <maven-jar-plugin.version>2.6</maven-jar-plugin.version>
        <maven-surefire-plugin>2.19.1</maven-surefire-plugin>
        <maven-assembly-plugin.version>2.5.5</maven-assembly-plugin.version>
        <spring.version>4.1.7.RELEASE</spring.version>
        <junit.version>4.11</junit.version>
        <maven-war-plugin.version>2.6</maven-war-plugin.version>
        <maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
        <tomcat.version>8.5.12</tomcat.version>
        <tomcat.8.0.version>8.0.50</tomcat.8.0.version>
        <log4j.version>1.2.16</log4j.version>
        <httpclient.version>4.5.3</httpclient.version>
        <jackson.version>2.9.5</jackson.version>
        <powermock.version>1.7.4</powermock.version>
        <junit.version>4.11</junit.version>
        <mockito.version>1.10.16</mockito.version>
        <slf4j.version>1.7.5</slf4j.version>
        <consul.version>0.14.0</consul.version>
        <json.version>20080701</json.version>
        <dom4j.version>1.6.1</dom4j.version>
        <implementation.version>7.0.0.0</implementation.version>
    </properties>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>${java.compiler.version}</source>
                    <target>${java.compiler.version}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven-jar-plugin.version}</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Implementation-Version>${project.version}</Implementation-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin}</version>
                <configuration>
                    <argLine>-Xmx512m -XX:MaxPermSize=256m</argLine>
                </configuration>
            </plugin>

        </plugins>

    </build>
    <modules>

    </modules>
</project>
Run Code Online (Sandbox Code Playgroud)

现在它显示了一个错误pom.xml

Project build error: Non-resolvable import POM: Could not find artifact com.fasterxml.jackson:jackson-bom:pom:2.10.5 in central (https://repo.maven.apache.org/maven2)
Run Code Online (Sandbox Code Playgroud)

我尝试了以下解决方案

  • 更新我的maven项目
  • 删除并重建.m2文件夹

请对上述查询提出建议。

Ana*_*han 1

maven 尝试解析的 jackson-bom 版本不在 maven 存储库中。当我检查最新版本时,版本是2.10.1。那么,您可以检查一下您的 pom.xml 中是否在任何地方显式设置了 jackson 版本吗?。如果您尝试删除它并让 Maven 解析来自 spring 的版本。