-
Maven relies on principles
- A > B > C and A > E > F > D > C, the former is preferred
- Declare first: If the path length is the same, then declare first.
-
Maven has A transitive dependency mechanism. If A depends on B and A dependency is introduced, Mave will be introduced along with B when resolving A.
- A > B > C > G21 guava (20.0)
- E > > F the G20 guava (21.0)
Assuming pom introduced A and E, maven can introduce guava 20.0 rather than G21, when the program is called G21 new method or class, will run out of A ClassNotFoundException/NoSuchMethodError
-
screening
- If it can be found, there may be a JAR conflict. If it cannot be found, there may be a missing JAR package, which can be introduced.
- Use MVN dependency:tree [-DVERBOSE -DIncludes =groupId:artifactId], or the DIEA plugin Maven Helper to view the dependency tree
- Check to see if the version in the lookup class is the same as the version in the Maven dependency
- The sample error: under Caused by: Java. Lang. NoClassDefFoundError: Org/springframework/core/env/EnvironmentCapable find classes, exist, conflict jars, reference of spring – the core 4.2.2
Looking at the dependency tree, Spring-Core3.0.7 was introduced, which is inconsistent with the class version
Find the conflict POM and add Exclusion