java项目dependences下面报错,红色波浪线

发布时间:2023年12月17日

1,问题:java项目dependences下面波浪线

在这里插入图片描述

方法一:重新加载maven依赖(未解决)

在这里插入图片描述
报错:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.486 s
[INFO] Finished at: 2023-12-14T09:27:45+08:00
[INFO] Final Memory: 18M/171M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project logistics-etl: Could not resolve dependencies for project cn.it:logistics-etl:jar:1.0-SNAPSHOT: Failed to collect dependencies at cn.it.logistics.common:logistics-common:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for cn.it.logistics.common:logistics-common:jar:1.0-SNAPSHOT: Could not transfer artifact cn.it.logistics.common:logistics-common:pom:1.0-SNAPSHOT from/to mvnrepository (https://mvnrepository.com/): Access denied to: https://mvnrepository.com/cn/it/logistics/common/logistics-common/1.0-SNAPSHOT/logistics-common-1.0-SNAPSHOT.pom , ReasonPhrase:Forbidden. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Process finished with exit code 1

在cmd里面进入项目目录下,执行“mvn clean install -e”重新清理加载maven项目
参考博客

又报错:

[ERROR] Failed to execute goal on project logistics-etl: Could not resolve dependencies for project cn.it:logistics-etl:jar:1.0-SNAPSHOT: Failed to collect dependencies at cn.it.logistics.common:logistics-common:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for cn.it.logistics.common:logistics-common:jar:1.0-SNAPSHOT: Could not transfer artifact cn.it.logistics.common:logistics-common:pom:1.0-SNAPSHOT from/to mvnrepository (https://mvnrepository.com/): authorization failed for https://mvnrepository.com/cn/it/logistics/common/logistics-common/1.0-SNAPSHOT/logistics-common-1.0-SNAPSHOT.pom, status: 403 Forbidden -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project logistics-etl: Could not resolve dependencies for project cn.it:logistics-etl:jar:1.0-SNAPSHOT: Failed to collect dependencies at cn.it.logistics.common:logistics-common:jar:1.0-SNAPSHOT

在这里插入图片描述

方法二(未解决)

有博主说,如果有子项目继承父项目的情况下。在父项目下有的子项目在首次运行clean 和install前应该先运行父项目的clean和install。
install父项目的时候同样报错。
在这里插入图片描述
也是去cmd的父项目目录下执行“mvn clean install -e”重新清理加载maven项目

参考博客

同样报错:
在这里插入图片描述

方法三(已解决)

总结,估计是创建的项目是jdk17,使用的jdk是jdk8?
现在不能在idea中创建jdk8的项目了。如果想要创建jdk8的项目,解决办法:

更改URL,使用云原生URL:https://start.aliyun.com/
在这里插入图片描述
也可以直接去云原生脚手架创建项目,下载文件并解压之后,idea打开即可。
使用云原生脚手架创建maven项目。可以使用jdk8
https://start.aliyun.com/
在这里插入图片描述

idea一直默认的是使用spring创建项目
https://start.spring.io/
可以看出已经不能使用jdk8了。
在这里插入图片描述

虽然java项目dependences下面报错,红色波浪线。但是项目依旧可以执行。

文章来源:https://blog.csdn.net/m0_58115520/article/details/134987338
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。