spring - 如何处理pom.xml中的 "omitted for conflict with.."消息?

标签 spring maven jar pom.xml dependency-management

我有这样的情况:

enter image description here

我知道“Maven 使用最近获胜策略解决版本冲突”。所以这里根据这个规则胜出aop 3.0.7。但我还在我的 pom 中定义了一个 dependencyManagement 部分,它看起来像这样:

    <properties>
        <org.springframework.version>3.2.4.RELEASE</org.springframework.version>
        <org.springframework.security.version>3.1.4.RELEASE</org.springframework.security.version>
    </properties>
    
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.springframework</groupId>
                <artifactId>spring-aop</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

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

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

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

        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.7.1</version>
        </dependency>

    </dependencies>

</project>

这就是依赖项选项卡上的样子:

enter image description here

所以我希望 spring-aop 使用 3.2.4.RELEASE 版本而不是像 webmvc 那样使用 3.0.7,因为我在依赖管理中定义了它。为什么仍然使用旧版本 3.0.7 ?

最佳答案

您的依赖管理声明有一个拼写错误(com.springframework 而不是 org.springframework)。

这是正确的 pom 条目:

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-aop</artifactId>
  <version>3.2.4.RELEASE</version>
</dependency>

不幸的是,由于未使用依赖项,Maven(或 Eclipse)不会将其标记为丢失的 Artifact 。

关于spring - 如何处理pom.xml中的 "omitted for conflict with.."消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19612755/

相关文章:

java - Spring Security 不适用于 "hasRole(' ROLE_ADMIN')"或 ROLE_ADMIN

java - Bean 范围 ("Request")不起作用

java - Spring/Eclipse 项目突然记录一切

java - 通过maven插件生成docker镜像

Maven 依赖解析和范围覆盖

java - ClassNotFoundException 错误。 Eclipse IDE 出现问题

java - 电子邮件发送Android Studio

java - 如何在 Spring Integration Mail Adapter for pop3 中实现事务

java - 为什么 Java RunTime 在 Hex.encodeHex() 方法调用上报告 java.lang.NoSuchMethodError?

java - 是否可以在Eclipse中自动将依赖的项目编译成jar?