包含 Openshift Java RESTClient 时构建失败

我有一个使用 Spring 的项目,只要我在 pom.xml 文件中包含以下内容:


<dependency>

<groupId>com.openshift</groupId>

<artifactId>openshift-restclient-java</artifactId>

<version>6.1.3.Final</version>

</dependency>

我得到以下错误集。有想法该怎么解决这个吗?


SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in [jar:file:/Users/m/.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: Found binding in [jar:file:/Users/m/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]

The Class-Path manifest attribute in /Users/m/.m2/repository/org/liquibase/liquibase-core/3.5.5/liquibase-core-3.5.5.jar referenced one or more files that do not exist: file:/Users/m/.m2/repository/org/liquibase/liquibase-core/3.5.5/lib/snakeyaml-1.13.jar

log4j:WARN No appenders could be found for logger (org.springframework.boot.devtools.settings.DevToolsSettings).

log4j:WARN Please initialize the log4j system properly.

log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)


繁花如伊
浏览 230回答 1
1回答

慕妹3242003

Spring boot 和 Openshift 库都使用 slf4j,这是一个日志桥框架。但是,它们都包含不同的绑定:Spring Boot 包含 LogbbackOpenshift 包括 log4j您可以通过排除其中任何一个来解决此问题,例如:<!-- language: lang-xml --><dependency>&nbsp; &nbsp; <groupId>com.openshift</groupId>&nbsp; &nbsp; <artifactId>openshift-restclient-java</artifactId>&nbsp; &nbsp; <version>6.1.3.Final</version>&nbsp; &nbsp; <exclusions>&nbsp; &nbsp; &nbsp; &nbsp; <exclusion>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.slf4j</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>slf4j-log4j12</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; </exclusion>&nbsp; &nbsp; </exclusions></dependency>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java