java - 如何从 spring boot pom 中排除或替换 jackson

标签 java spring maven spring-boot pom.xml

我正在使用 spring boot 1.5.12.RELEASE。它工作正常,我能够构建项目。

但是现在想升级spring boot版本到1.5.15.RELEASE。我遇到了错误。

Plugin org.springframework.boot:spring-boot-maven-plugin:1.5.15.RELEASE or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.springframework.boot:spring-boot-maven-plugin:jar:1.5.15.RELEASE: Failure to transfer com.fasterxml.jackson:jackson-bom:pom:2.8.11.20180608

我有自己的存储库,所以无法从 Maven 存储库下载文件。我有 jackson 2.8.11.20180217 的版本。我没有 2.8.11.20180608 版本。

那么有什么方法可以使用版本 2.8.11.20180217 而不是 2.8.11.20180608 或者不使用 jackson。

最佳答案

为你想要的 jackson 版本添加 maven 依赖,并为所有需要 id 的模块排除 jackson 依赖:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

关于java - 如何从 spring boot pom 中排除或替换 jackson,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52093444/

相关文章:

java - 当我使用 SpEL 时出现 NoSuchBeanDefinitionException

java - 带 testNG 的 spring 没有子类化

scala - Intellij 多模块 maven 项目,其中一个子模块中的更新不会传播到 war

java - Eclipse/Maven 项目缺少必需的库/缺少 Artifact

maven - Docker Maven插件:运行容器时如何指定shm大小

java - 分数到循环小数

java - Spring Controller "redirect"

java - 使用 Log4j 进行日志记录需要很长时间

java - 在 Java 泛型的情况下,向后兼容性到底意味着什么?

java - 多线程Java