Maven Build-[错误] org.springframework.cloud:spring-cloud-starter-zuul:jar 的“dependencies.dependency.v

Posted

技术标签:

【中文标题】Maven Build-[错误] org.springframework.cloud:spring-cloud-starter-zuul:jar 的“dependencies.dependency.version”缺失。 @ 第 28 行,第 15 列【英文标题】:Maven Build- [ERROR] 'dependencies.dependency.version' for org.springframework.cloud:spring-cloud-starter-zuul:jar is missing. @ line 28, column 15 【发布时间】:2020-06-08 03:50:20 【问题描述】:

POM.XML

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.ge.aviation.clearview</groupId>
    <artifactId>clearview-api-gateway</artifactId>
    <version>1.0.24</version>
    <packaging>jar</packaging>

    <name>clearview-api-gateway</name>
    <description>API Gateway</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-zuul</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jersey</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-jpa</artifactId>
            </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.2.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.commons</groupId>
           <artifactId>commons-io</artifactId>
           <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.6.1</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.6.1</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-joda</artifactId>
        </dependency>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>

      <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        </dependency>
      <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security.oauth</groupId>
            <artifactId>spring-security-oauth2</artifactId>
            <version>2.0.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin.external.google</groupId>
            <artifactId>android-json</artifactId>
            <version>0.0.20131108.vaadin1</version>
            <scope>compile</scope>
        </dependency>

    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Dalston.BUILD-SNAPSHOT</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <finalName>clearviewcmr-gateway-service</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>


</project>

-> 尽管定义了 dalston 版本,但根据错误缺少 Zuul jar [错误]

从 spring-snapshots 下载:https://repo.spring.io/snapshot/org/springframework/cloud/spring-cloud-dependencies/Dalston.BUILD-SNAPSHOT/spring-cloud-dependencies-Dalston.BUILD-SNAPSHOT.pom [错误] [错误] 处理 POM 时遇到一些问题: [错误] 不可解析的导入 POM:无法将工件 org.springframework.cloud:spring-cloud-dependencies:pom:Dalston.BUILD-SNAPSHOT 从/向 spring-snapshots (https://repo.spring.io/snapshot) 传输:https://repo.spring.io/snapshot/org/springframework/cloud/spring-cloud-dependencies/Dalston.BUILD-SNAPSHOT/spring-cloud-dependencies-Dalston.BUILD-SNAPSHOT.pom 传输失败ProxyInfohost='cinext11.proxy.corporate.ge.com', userName='null', port=80, type='https', nonProxyHosts='null' @ 第 111 行,第 16 列 [错误] org.springframework.cloud:spring-cloud-starter-zuul:jar 的“dependencies.dependency.version”缺失。 @ 第 28 行,第 15 列

【问题讨论】:

请尝试提出更明确的问题。你想达到什么目标,什么是行不通的? 您要查找的版本不存在:repo.spring.io/snapshot/org/springframework/cloud/… @TobiO ,如上所述,当我使用 MVN 全新安装时,出现了错误消息。 @SiKing 您评论中提供的链接确实包含在我的 POM.xml 中使用的 Dalston.BUILD-SNAPSHOT/ 版本。 但是根据错误,缺少的依赖项是版本“Greenwich.SR1”。这可能是作为传递依赖被拉取的。 【参考方案1】:

Spring-Cloud 的 Dalston 发布火车于 2016 年发布。 你不应该再使用它的 SNAPSHOT 版本了。

从 2017 年 12 月开始发布 Dalston.SR5,这将导致:

spring-cloud-dependencies:Dalston.SR5
-> spring-cloud-netflix-dependencies:1.3.6.RELEASE
-> spring-cloud-starter-zuul:1.3.6.RELEASE
-> zuul-core:1.3.0

如果您开始一个新项目并且您拥有 Spring Boot 2.2.x,您还可以使用最新的发布系列 (Hoxton)。然而,Spring Cloud 从未升级到 Netflix Zuul 2,但发布了替代方案:Spring-Cloud-Gateway。见How is Spring Cloud Gateway different from Zuul?

底线:避免依赖 spring-snapshots 或 spring-milestones 存储库,除非您需要前沿版本。

【讨论】:

以上是关于Maven Build-[错误] org.springframework.cloud:spring-cloud-starter-zuul:jar 的“dependencies.dependency.v的主要内容,如果未能解决你的问题,请参考以下文章

maven项目导入后出现这个错误Project build error: Unresolveable build extension: Plugin

Maven项目出现 could not calculate build plan:plugin 错误

Maven项目进行update project时出现Could not calculate build plan错误

maven项目出现如下错误,求指点;CoreException: Could not calculate build plan:

Maven:如何使用 build.gradle 文件?

Maven错误:‘build.plugins.plugin.version‘ for org.apache.maven.pluginsmaven-compiler-plugin is