簡體   English   中英

Maven project sourcing old spring dependencies not part of the pom.xml in Eclipse

[英]Maven project sourcing old spring dependencies not part of the pom.xml in Eclipse

我的 maven java 項目正在采購我的 pom.xml 中未定義的 spring 庫的版本

我的 pom.xml 沒有對 spring 依賴項的 v3.0.5 的任何引用。 我的 pom.xml 的片段:

    <properties>
        <org.springframework.version>3.2.4.RELEASE</org.springframework.version>
    </properties>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-oxm</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-webmvc</artifactId>
                </exclusion>
                <exclusion>
                    <artifactId>spring-webmvc</artifactId>
                    <groupId>org.springframework</groupId>
                </exclusion>
            </exclusions>
        </dependency>

但是,當我執行mvn clean -U compile package時,我在目標中獲得了 spring 庫的 v3.0.5: 在此處輸入圖像描述

有人可以幫助我如何刪除過時/過時的版本 spring 庫,這些庫似乎是“自動”獲取的,但沒有包含在我的 pom 中。

謝謝

在獲取或包含有問題的 jar 的元素中添加一個元素。這些不需要的庫版本作為傳遞依賴項來自 POM.xml 中提到的依賴項之一。 使用 eclipse 或 IntelliJ 依賴樹找出 jar 帶來那些傳遞依賴,然后將它們從該元素中排除。

<project>
  ...
  <dependencies>
    <dependency>
      <groupId>sample.ProjectA</groupId>
      <artifactId>Project-A</artifactId>
      <version>1.0</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>  <!-- declare the exclusion here -->
          <groupId>sample.ProjectB</groupId>
          <artifactId>Project-B</artifactId>
        </exclusion>
      </exclusions> 
    </dependency>
  </dependencies>
</project>

查找傳遞依賴樹/列表: How can I view transitive dependencies of a Maven pom.xml file?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM