pom.xml里有红叉报错的解决办法

pom.xml里有红叉报错的解决办法一:

1.把鼠标点在报的错上发现pom.xml报如下错误:

Multiple annotations found at this line:

- Failure to transfer org.slf4j:slf4j-log4j12:jar:1.7.21 from http://repo1.maven.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. Original error: Could not transfer artifact org.slf4j:slf4j-log4j12:jar:1.7.21 from/
to central (http://repo1.maven.org/maven2): ConnectException

2.将pom.xml中的这个jar包删掉

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
</dependency>

解决办法二:

项目右键,properties,java build path,找到meaven依赖里有红叉的jar包,将pom.xml中的这个jar包删掉即可

 使用spring cloud实现分布式配置管理时加入依赖后pom.xml第一行报错

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>

解决办法:给依赖添加版本号即可。

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
<version>1.2.2.RELEASE</version>
</dependency>

原文地址:https://www.cnblogs.com/yuxiaona/p/6258877.html