gpt4 book ai didi

java - 如何修复依赖错误项目构建错误: dependencies cloud:spring-cloud-starter-openfeign:jar is missing

转载 作者:行者123 更新时间:2023-12-02 01:12:34 28 4
gpt4 key购买 nike

我在 eclipse java 中有 pom.xml,用于在 java 中构建简单的 Rest Web 服务,但是该依赖项显示错误,我已经尝试并且添加版本和更新项目在依赖项中仍然存在错误,我该如何修复它? …………

这是我的pom

<?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.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.bsm</groupId>
<artifactId>spring-scheduler-decrypt-file</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring-scheduler-decrypt-file</name>
<description>Demo project for Spring Boot</description>

<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Hoxton.RC2</spring-cloud.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</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>
</plugin>
</plugins>
</build>

</project>

这是我的错误依赖项

项目构建错误:org.springframework.cloud:spring-cloud-starter-openfeign:jar 的“dependency.dependency.version”丢失。

最佳答案

我认为你可以尝试一些事情:

1.将版本的字面值放入子pom中

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>X.Y.Z</version>

</dependency>
  • 清除通常位于 C:\Users\user.m2\repository 的 .m2 缓存。我想说,当我在 Maven 中工作时,我经常这样做。特别是在提交之前,这样我就可以更有信心 CI 会运行。您不必每次都删除该文件夹,有时只需项目包和 .cache 文件夹就足够了。
  • 如果第 1 点不起作用,那么在 pom 中的属性标记之后添加以下内容

    <dependencyManagement>
    <dependencies>
    <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-dependencies</artifactId>
    <version>Hoxton.RC2</version>
    <type>pom</type>
    <scope>import</scope>
    </dependency>
    </dependencies>
    </dependencyManagement>

    关于java - 如何修复依赖错误项目构建错误: dependencies cloud:spring-cloud-starter-openfeign:jar is missing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59151300/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com