解决【BUILD FAILURE】2 errors程序包org.springframework.cloud.netflix.zuul不存在;StarterZuul.java:[10,2] 找不到符号

zuulClient Maven install报错信息:

[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< com.carina:zuul-client >-----------------------
[INFO] Building zuul-client 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.springframework.cloud:spring-cloud-starter-eureka:jar:1.4.0.RELEASE is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.springframework.cloud:spring-cloud-starter-config:jar:1.4.0.RELEASE is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.springframework.cloud:spring-cloud-starter-zuul:jar:1.4.0.RELEASE is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ zuul-client ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ zuul-client ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to F:\Ec\eclipse64\zuul-client\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /F:/Ec/eclipse64/zuul-client/src/main/java/com/carina/StarterZuul.java:[5,46] 程序包org.springframework.cloud.netflix.zuul不存在
[ERROR] /F:/Ec/eclipse64/zuul-client/src/main/java/com/carina/StarterZuul.java:[10,2] 找不到符号
  符号: 类 EnableZuulProxy
[INFO] 2 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.319 s
[INFO] Finished at: 2022-04-27T15:21:34+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project zuul-client: Compilation failure: Compilation failure: 
[ERROR] /F:/Ec/eclipse64/zuul-client/src/main/java/com/carina/StarterZuul.java:[5,46] 程序包org.springframework.cloud.netflix.zuul不存在
[ERROR] /F:/Ec/eclipse64/zuul-client/src/main/java/com/carina/StarterZuul.java:[10,2] 找不到符号
[ERROR]   符号: 类 EnableZuulProxy
[ERROR] -> [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/MojoFailureException

解决方案:

Edgware.RELEASE改为Dalston.RELEASE

SpringCloud版本:

 我的SpringBoot版本:

<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.5.9.RELEASE</version>
</parent> 

可参考以下文章对应版本

SpringCloud与SpringBoot的版本对应关系_richest_qi的博客-优快云博客_springboot和springcloud版本对应关系在SpringCloud官网(https://spring.io/projects/spring-cloud)可以看到,当前(2021年11月),SpringCloud的最新GA版本是2020.0.4这一版。除了2020.0.X版本外,SpringCloud之前的版本名称是伦敦地铁站的站名命名,且首字母顺序与版本时间顺序一致,如,AngelBrixtonCamdenDalstonEdgwareFinchleyGreenwichHoxton当SpringCloud的发布内容积累到临界点或https://blog.youkuaiyun.com/qzw752890913/article/details/121073738

### Java Spring Framework Beans Factory Annotation Package Not Found Compile Error Solution For resolving the issue where the compiler cannot find the `org.springframework.beans.factory` annotations, several factors need to be considered and addressed. The build configuration file (e.g., Maven's pom.xml or Gradle’s build.gradle) should include dependencies that contain these annotations. If missing, adding them can resolve compilation errors related to unresolved symbols from this package[^1]. In a Maven project setup, ensure inclusion of the following dependency within `<dependencies>` section: ```xml <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>${spring.version}</version> </dependency> ``` Similarly, for projects using Gradle as their build tool, add corresponding lines inside `dependencies {}` block: ```groovy implementation 'org.springframework:spring-beans:${spring_version}' ``` Ensure version compatibility between different components used across application development; mismatched versions might lead to unexpected issues during runtime even after successful compilation. Additionally, verify IDE configurations such as classpath settings which could affect how sources are indexed by tools like IntelliJ IDEA or Eclipse. Sometimes refreshing/cleaning caches may help solve transient problems caused by stale metadata about libraries present on disk but not properly recognized due to caching mechanisms employed internally within those environments. When implementing advanced customizations through Java Configuration with interfaces like CachingConfigurer, it is important also to maintain proper references throughout codebase structure so all necessary classes remain accessible at both design time and execution phases without causing conflicts elsewhere in software architecture[^2].
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值