Maven- POM.xml中依赖项排序的重要性

Chi*_*may 2 java spring pom.xml maven

pom.xml中依赖项的意义是什么?

我按以下顺序拥有依赖项:

  1. CGLIB
  2. Apache Commons
  3. 春季数据
  4. 过冬
  5. MySQL连接器
  6. 弹簧

如果我在Spring上随处插入Spring Security依赖项,我会收到错误.例如,如果我在最顶层插入两个依赖项,我会得到此异常(运行前也是编译器错误):

java.lang.NoClassDefFoundError:org/springframework/core/env/EnvironmentCapable

And*_*hev 5

Maven中的依赖顺序无关紧要.

添加Spring Security依赖项之后,您需要删除Spring依赖项,因为Spring Security引用了包含此类的不同版本的Spring.

所以删除Spring依赖应该解决这个问题.