首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring引导生成器错误:缺少org.springframework.cloud:spring-cloud-starter-netflix-hystrix:jar的“dependencies.dependency.version”

Spring引导生成器错误:缺少org.springframework.cloud:spring-cloud-starter-netflix-hystrix:jar的“dependencies.dependency.version”
EN

Stack Overflow用户
提问于 2022-08-06 17:56:20
回答 2查看 672关注 0票数 0

当我要将spring-cloud-starter-netflix-hystrix依赖项添加到pom.xml文件时,构建失败了。该项目已经由spring云网关、netflix-eureka客户端和引导程序构建。我想在这个项目中添加spring-cloud-starter netflix-hystrix依赖项,以启用断路器。

org.springframework.cloud:spring-cloud-starter-netflix-hystrix:jar的“`ERROR‘dependencies.dependency.version”丢失了。@第39行,第15栏

这里我提到了pom.xml文件

代码语言:javascript
复制
    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.2</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.yasas</groupId>
    <artifactId>order-service-api-gateway</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>order-service-api-gateway</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>15</java.version>
        <spring-cloud.version>2021.0.3</spring-cloud.version>
        <maven.compiler.source>15</maven.compiler.source>
        <maven.compiler.target>15</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-gateway</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bootstrap</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
EN

回答 2

Stack Overflow用户

发布于 2022-08-06 18:09:16

错误说明您缺少org.springframework.cloud:spring-cloud-starter-netflix-hystrix的版本。您可以在<properties>部分下声明适当的版本(例如,我正在使用最新版本,这里可以使用任何适当的版本):

代码语言:javascript
复制
<properties>
..
  <spring-cloud-starter-netflix-hystrix.version>2.2.10.RELEASE</spring-cloud-starter-netflix-hystrix.version>
</properties>

&内部依赖标签:

代码语言:javascript
复制
<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
            <version>${spring-cloud-starter-netflix-hystrix.version}</version>
        </dependency>
票数 0
EN

Stack Overflow用户

发布于 2022-08-13 15:33:34

我用的是resilience4j断路器,而不是玻璃断路器。我在API网关服务中的工作正如我所期望的。

代码语言:javascript
复制
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-circuitbreaker-reactor-resilience4j</artifactId>
        </dependency>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73262129

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档