【问题标题】:Cannot reach spring-boot-starter-parent dependencies无法达到 spring-boot-starter-parent 依赖项
【发布时间】:2021-04-29 01:47:33
【问题描述】:

我正在使用https://start.spring.io/ 创建 Spring Boot 项目,在开发中我无法访问 Spring Boot 启动器这些依赖项:

<dependency>
    <groupId>org.springframework.ws</groupId>
    <artifactId>spring-ws-support</artifactId>
        <version>3.0.10.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-oxm</artifactId>
        <version>5.3.2</version>
</dependency>

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
        <version>4.5.13</version>
</dependency>

<dependency>
    <groupId>com.sun.xml.messaging.saaj</groupId>
    <artifactId>saaj-impl</artifactId>
        <version>1.5.2</version>
</dependency>

我收到警告消息:

Overriding managed version 5.3.1 for spring-oxm
Overriding managed version 5.3.1 for spring-oxm
Duplicating managed version 4.5.13 for httpclient
Duplicating managed version 1.5.2 for saaj-impl

我已经搜索了如何修复它,一些人提到的解决方法之一是在 &lt;/version&gt; 标签末尾使用 &lt;!--$NO-MVN-MAN-VER$ --&gt; 来忽略警告。

我的问题是如何从 Spring Boot 中看到这些(以及其他未来的依赖项)?

编辑#1: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 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.4.0</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>xx.xx.xxx</groupId>
    <artifactId>yyyy</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>yyyy</name>
    <description>zzzzz</description>

    <properties>
        <java.version>11</java.version>

        <apache.cxf.version>3.4.1</apache.cxf.version>
        <apache.httpcomponents.version>4.5.13</apache.httpcomponents.version>
        <jaxb2.maven2.version>0.14.0</jaxb2.maven2.version>

        <springframework.version>5.3.2</springframework.version>
        <springframework.ws.version>3.0.10.RELEASE</springframework.ws.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <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>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${apache.cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <version>${jaxb2.maven2.version}</version>
            <type>maven-plugin</type>
        </dependency>
        <dependency>
            <groupId>org.springframework.ws</groupId>
            <artifactId>spring-ws-support</artifactId>
            <version>${springframework.ws.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-oxm</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${apache.httpcomponents.version}</version>
        </dependency>
    </dependencies>
</project>

【问题讨论】:

  • 请编辑问题并添加您的 pom.xml。
  • 这些由 Spring Boot 管理,但您正在覆盖它们。您不需要 spring-oxm 和 spring-ws 依赖项,而是 spring-boot-starter-webservices 依赖项,它们将自动添加。
  • @tgdavies 添加编辑
  • 您明确地为出现在父 pom 的 depenedencyManagwement 部分中的依赖项提供版本。
  • @tgdavies 解决了我的问题

标签: java spring spring-boot maven pom.xml


【解决方案1】:

解决方案是删除&lt;version&gt;...&lt;/version&gt;,让Spring boot处理版本。

感谢 tgdavies。

【讨论】:

    猜你喜欢
    • 2018-01-10
    • 1970-01-01
    • 2018-12-16
    • 2015-12-20
    • 2016-06-21
    • 1970-01-01
    • 2018-05-01
    • 2021-09-08
    • 2023-03-24
    相关资源
    最近更新 更多