错误提示:java: 警告: Connot resolve io.seata:seata-all:1.3.0
这是因为jar包无法被解析导致
原因:
seata版本与idea版本不匹配,需要手动选定jar包
解决方案
加如下依赖即可
如果加完依赖依旧未解决问题或者出现如下情况(不报错,但是jar包无法被引用)
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
<exclusions>
<exclusion>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
那就是maven配置有误
解决办法如下
一:打开idea,左上角file->settings
一:找到Maven
重新更新依赖,启动项目
<dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-seata</artifactId> </dependency>
如下所示,项目正常运行就ok了
2022-08-26 20:50:41.342 INFO 17948 --- [ restartedMain] c.a.c.n.registry.NacosServiceRegistry : nacos registry, DEFAULT_GROUP seata-storage 192.168.1.76:8003 register finished
2022-08-26 20:50:41.450 INFO 17948 --- [ restartedMain] com.ykq.StorageApplication : Started StorageApplication in 3.299 seconds (JVM running for 4.097)
2022-08-26 20:50:41.454 INFO 17948 --- [ restartedMain] c.a.n.client.config.impl.ClientWorker : [fixed-localhost_8848] [subscribe] seata-storage+DEFAULT_GROUP
2022-08-26 20:50:41.454 INFO 17948 --- [ restartedMain] c.a.nacos.client.config.impl.CacheData : [fixed-localhost_8848] [add-listener] ok, tenant=, dataId=seata-storage, group=DEFAULT_GROUP, cnt=1
2022-08-26 20:50:41.455 INFO 17948 --- [ restartedMain] c.a.n.client.config.impl.ClientWorker : [fixed-localhost_8848] [subscribe] seata-storage.properties+DEFAULT_GROUP
2022-08-26 20:50:41.455 INFO 17948 --- [ restartedMain] c.a.nacos.client.config.impl.CacheData : [fixed-localhost_8848] [add-listener] ok, tenant=, dataId=seata-storage.properties, group=DEFAULT_GROUP, cnt=1
2022-08-26 20:50:42.352 INFO 17948 --- [g.push.receiver] com.alibaba.nacos.client.naming : received push data: {"type":"dom","data":"{\"hosts\":[{\"ip\":\"192.168.1.76\",\"port\":8003,\"valid\":true,\"healthy\":true,\"marked\":false,\"instanceId\":\"192.168.1.76#8003#DEFAULT#DEFAULT_GROUP@@seata-storage\",\"metadata\":{\"preserved.register.source\":\"SPRING_CLOUD\"},\"enabled\":true,\"weight\":1.0,\"clusterName\":\"DEFAULT\",\"serviceName\":\"DEFAULT_GROUP@@seata-storage\",\"ephemeral\":true}],\"dom\":\"DEFAULT_GROUP@@seata-storage\",\"name\":\"DEFAULT_GROUP@@seata-storage\",\"cacheMillis\":10000,\"lastRefTime\":1661518242351,\"checksum\":\"d546e49c4c642c4b9e9b314fc46cf878\",\"useSpecifiedURL\":false,\"clusters\":\"DEFAULT\",\"env\":\"\",\"metadata\":{}}","lastRefTime":1932226787000} from /192.168.1.76
2022-08-26 20:50:47.358 INFO 17948 --- [g.push.receiver] com.alibaba.nacos.client.naming : received push data: {"type":"dom","data":"{\"hosts\":[{\"ip\":\"192.168.1.76\",\"port\":8003,\"valid\":true,\"healthy\":true,\"marked\":false,\"instanceId\":\"192.168.1.76#8003#DEFAULT#DEFAULT_GROUP@@seata-storage\",\"metadata\":{\"preserved.register.source\":\"SPRING_CLOUD\"},\"enabled\":true,\"weight\":1.0,\"clusterName\":\"DEFAULT\",\"serviceName\":\"DEFAULT_GROUP@@seata-storage\",\"ephemeral\":true}],\"dom\":\"DEFAULT_GROUP@@seata-storage\",\"name\":\"DEFAULT_GROUP@@seata-storage\",\"cacheMillis\":10000,\"lastRefTime\":1661518247358,\"checksum\":\"d546e49c4c642c4b9e9b314fc46cf878\",\"useSpecifiedURL\":false,\"clusters\":\"DEFAULT\",\"env\":\"\",\"metadata\":{}}","lastRefTime":1937233975600} from /192.168.1.76
希望可以帮助到你